|
Antti, thank you for your reply. I had set something like that up in my classes but something isn't working correctly. I'm just doing this to prove that the list works - which at the moment it doesn't. Thanks for the circular linked list tip.
Thanks again,
lordmickel
|
|
|
|
|
Your first problem is that you are not storing valid pointers in your list. Try replacing the load code with,
details * driver = new details ;
driver->enter_driver_name();
output.DisplayDriverName(driver->get_name());
list.add_driver(driver);
And to print the contents try,
details* pDriver = list.getFirstDriver();
while ( pDriver )
{
cout << "name: " << pDriver->get_name() << "\n" << endl;
pDriver = list.getNextDriver () ;
}
Note I haven't suggested changed anything in your details or list classes which are basically working... Although you haven't made any attempt to manage memory, a 'package' should probably be able to delete a 'details' and a 'driver_list' should probably have a destructor that deletes all the packages.
Paul
|
|
|
|
|
Paul, please forgive me for the extremely late reply. I've changed the code and it works perfectly, thank you so much for your very helpful reply!
Thank you,
lordmickel
|
|
|
|
|
Does anyone have ideas on how i can retrieve the following system information:
1. processor serial #
2. hard-disk serial #
Thanks
larry_larry
|
|
|
|
|
GetVolumeInformation() will get you a disk's serial number.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
For the processor serial number, you have to dive into assembly language, but mixing assembly and C++ is not hard. See this Intel PDF[^] for details of the CPUID instruction and how to use it. Bear in mind that a) onyl Pentium III and above actually support the CPU serial number b) it can usually be turned off in the BIOS, even if the processor supports it.
For the hard disk serial number, if you mean the volume serial number, then Ravi's answer is all you need. If you're after the physical serial number that the manufacturer puts on a drive, that's more tricky, since you'll need different approaches for IDE and SCSI drives, and even then the actual physical disks may be connected to a RAID controller, which is "hiding" the actual hardware.
|
|
|
|
|
Graham Bradshaw wrote:
Bear in mind that a) onyl Pentium III and above actually support the CPU serial number b) it can usually be turned off in the BIOS, even if the processor supports it.
and c) in Windows, only device drivers have the required privilege level to use the CPUID instruction.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
in Windows, only device drivers have the required privilege level to use the CPUID instruction
Are you sure that's true? I've just stepped though a program we have here that uses the CPUID instruction to get the vendor string and other info, and I was running VC6 interactively on the desktop (with Administrative privileges on a WinXP SP1 machine). I'm not using a device driver, just running a desktop application.
|
|
|
|
|
Graham Bradshaw wrote:
Are you sure that's true?
As I recall, CPUID is a ring-0 privileged instruction. The Windows kernel must be implementing an exception handler and performing the CPUID on behalf of the application.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Well, if you want Physical Numbers and you do not want to go into device driver writing, the best option is to go to WMI. WMI provides such classes which can provide you these things. Look at Win32_Processor and Win32_DiskDrive in MSDN. This will help you.
Imagine that you are creating a fabric of human destiny with the object of making men happy in the end, giving them peace and rest at last, but that it was essential and inevitable to torture to death only one tiny creature..and to found that edifice on its unavenged tears, would you consent to be the architect on those conditions? Tell me, and tell me the truth!
-Fyodor Dostoevsky, The Brothers Karamazov
|
|
|
|
|
|
|
1)How do u access functions that are within structures and make them return a value to not the main but to another (void) function ? ( Dunno if qn is phrase is correctly ??)
2)Below is an excerpt from a vending machine program in C++ but how do u convert to C without using ::(the scope resolution operator) ? or Is the below program unable to be converted to C...
BTW: some reasoning of the program may be wrong especially the data inside Convert_to_Denom as this part is wat me coded moiself...^^;;
Mani Thks for all who readin tis
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
struct coins{
int denomination;
void setDenom(int);
int getDenom();
};
struct machine{
struct coins ten, twenty, fifty;
};
void Convert_to_Denom(struct machine *m);
main()
{
struct machine *mac;
Convert_to_Denom(&mac);
return 0;
}
void Convert_to_Denom(struct machine *m)
{
m->fifty.setDenom(50);
m->twenty.setDenom(20);
m->ten.setDenom(10);
printf("%d",m->fifty.getDenom());
printf("%d",m->twenty.getDenom());
printf("%d",m->ten.getDenom());
}
void coins::setDenom(int D)
{
denomination = D;
}
int coins::getDenom()
{
return denomination;
}
|
|
|
|
|
1. The question is not phrased reasonably. But this is how I understand it "How can I call a function inside a structure ?" and "How can I determine the location where the return value is stored ?"
For the first, calling a function inside a structure is just like calling any other function, the difference is that you need to have an object of the structure and use the member-of operator (. or ->). An example:
struct coins
{
void Function1(void) {}
void Function2(void) {}
};<DIV>
int main(void)
{
coins objCoin;
objCoin.Function1();
objCoin.Function2();
return 0;
} In your code piece, the Convert_To_Denom function will not work, because you have not initialized the pointer 'mac' before passing it as a function parameter. What you are doing is declaring a pointer-to-struct type, but you're not assigning it i.e. it does not point anywhere. If you use this pointer as is, the program will cause a run-time error. To make the code work, you must remove the asterisk from the declaration of 'mac'. This way, you will create an object of structure 'machine', and pass the address of this object into the function, which will then use the created pointer to access the members ten, twenty and fifty of the structure.
For the second question, you can nest function calls inside each other, if the return values and parameter types match. An example:
int Function1(void) { return 1; }
void Function2( int nValue ) { printf("%d", nValue); }<DIV>
int main(void)
{
Function2( Function1() );<DIV>
return 0;
}
Does this answer your questions ? If not, rephase your question, spell check it and write it in clear, plain english. Do not use abbreviations or other things which might leave your question unclear to other readers. For example, the 'qn' does not mean anything unless you can decipher it from the sentence context. If the sentence context is unclear or mistyped, the entire idea of the sentence (and thus your question) will be ruined.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
hi there
i've made an activeX control which is capable of playing wav files. i was wondering how i could use this control so that i could actually hear the content on the web using IE or any other browser. Also the reason i've developed this control is that i need to play vox files which are automatically converted through the control. Any ideas,opnions or workarounds on how i could use this control to stream on the web or local lan? also are there any open source or free vox converters or players available?
Thanks
|
|
|
|
|
The Bass libraries at http://www.un4seen.com[^] allow you to play streaming audio. Commercial use requires a licensing fee. Speaking from personal use, I highly recommend these libs.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hello.I have a small problem.
I cannot insert new Items in my Toolbox.
To insert I can, but those are then grey and
not clickable.Thus, I can not use her.
It would be nice, if someone says to me, where the problem lies.
It concerns Visual Studio.Net 2003.
I thank ahead.
|
|
|
|
|
If I am not mistaken, you want to insert items in the Toolbar (not Toolbox). The items in a toolbar will remain grayed unless you write a handler for those items. Just right-click the item in design view and click Add Handler. A Wizard will appear which will do the remaining stuff.
Imagine that you are creating a fabric of human destiny with the object of making men happy in the end, giving them peace and rest at last, but that it was essential and inevitable to torture to death only one tiny creature..and to found that edifice on its unavenged tears, would you consent to be the architect on those conditions? Tell me, and tell me the truth!
-Fyodor Dostoevsky, The Brothers Karamazov
|
|
|
|
|
I need a timer.In Toolbox, in Kontexmenu ' Add new Item ' select, come a window with different new tools, ' Timer ' mark and to ' OK ' click.In Toolbox came, but grey and not clickable.
|
|
|
|
|
my application is based on touch screen and use listctrl to list all user,so i want to set list height to make user to select list item easily.how can i do it?thanks.
Happy Gemini
|
|
|
|
|
|
How do I get information from the file properties section of a file? What I want to do is use C or C++ to get the lyrics field from an audio file.
Any ideas?
-- dessa99
|
|
|
|
|
I believe that you're looking for the information on how to view the 'Summary' of a file, as displayed by Windows Explorer.
First, to achieve this, you need to know COM programming. I will describe the method in a short-handed manner. If you do not know shell programming, then this list of information will not be very helpful.
1. Get the desktop folder item
2. Navigate into the folder where the file is (IShellFolder::BindToObject)
3. Get a pointer to the file's IShellFolder interface, and query it for IShellFolder2 interface
4. Call IShellFolder2::GetDetailsOf, passing NULL in the first parameter, and an increasing column index as the second. The third parameter will return the title of the indexed column or E_FAIL if the index doesn't exist.
The MSDN says the same in a more verbose manner:
"The available information fields and their column numbers vary depending on the particular folder. To enumerate the available fields call IShellDetails::GetDetailsOf with pidl set to NULL for increasing values of iColumn. This approach provides you with the title associated with each column index. When iColumn exceeds the number of columns supported by the folder, IShellDetails::GetDetailsOf will return E_FAIL. Bear in mind that these titles are localizable, and may not be the same for all locales."
After you have the titles, and can identify the index of the title you're interested in, then you need to get the PIDL (Pointer to item identifier list) of the file. To get this, use the IShellFolder pointer you had, call IShellFolder::GetDisplayNameOf and use the display name with SHParseDisplayName to get the PIDL. Then call IShellFolder2::GetDetailsOf again with the PIDL and column index. You'll be presented with the information you were looking for.
If none of this makes sense, you should begin your journey in MSDN by searching for 'Shell Basics' and learn the concepts required to program the Shell. It's a difficult and quite a complex thing to learn, but once you master at least a part of it, your skills and options in using Windows OS is much more varied.
Hope this helps.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
How can I make so that disabled menu items are not highlighted when I put cursor on them?
|
|
|
|
|
I would suggest that you have to subclass and write your own owner drawn menu for this.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|