|
Hello,
I know how to change the dropdown width of a combobox during runtime, but does anyone know how to change the width of the actual combobox at runtime?
Thanks,
Murrah Boswell
|
|
|
|
|
The combo box is the actual control, and the drop-down list box is a child of the combo box.
- To set the width of the list box, send a CB_SETDROPPEDWIDTH message (Win32) or call CComboBox::SetDroppedWidth (MFC).
- To set the width of the combo box control, call SetWindowPos (Win32) or CWnd::SetWindowPos (MFC).
Hope this helps you out.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks for the replay,
How do I get the CWnd handle of my ComboBox?
Murrah Boswell
|
|
|
|
|
Disregard CWnd question, I figured it out!
Thanks for your help,
Murrah Boswell
|
|
|
|
|
GetDlgItem(MY_COMBO)
TOXCCT >>> GEII power
|
|
|
|
|
Hi, I've created a linked list and in my C++ source file I'm creating objects and passing them to a linked list in a loop. I want to loop over the linked list to show that the values are actually in the list. How would I do this?
I've uploaded all the code here if you want to take a look: http://www.hostmaster-x.co.uk/c++/
Thanks in advance for any help.
Cheers,
lordmickel
|
|
|
|
|
If this is not homework, why are you not just using the list class included in C++ ?
Otherwise, just grab the first item, and keep stepping through the list, printing out each item as you go, or whatever else your homework requires. The code you've commented out looks like it should work, if your list is working.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian, thank you for your reply. This is homework - kind of. I'm not taking classes as such, just dabbling a little. From what you have said it would seem that the list isn't working correctly because when I uncomment the code I get the following output:
Please enter the driver's name then press enter:
driver1
name = driver1
driver2
name = driver2
driver3
name = driver3
name 1:
name 2:
name 1:
name 2:
Press any key to continue
Any ideas what the problem could be?
Cheers again,
lordmickel
|
|
|
|
|
lordmickel wrote:
This is homework - kind of. I'm not taking classes as such, just dabbling a little.
Cool - I applaud that you're writing your own list then. Once it works, you'll understand how they work, and you should then use the STL exclusively
What happens when you step through the code in the debugger ? Are your values getting stored correctly in the list ? What about the pointer values as you step through, where do they go ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thank you, thank you! ........ I'm not really familiar with stepping through the code, MS VC++ doesn't seem to be too helpful - or perhaps its just me. Unfortunately I can't really answer any of your questions exactly.
When I ran the debugger, the command prompt popped up and began running the program. When it had finished it produced this:
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0xF9C has exited with code 0 (0x0).
The program 'C:\Program Files\Microsoft Visual Studio\MyProjects\text_class\Debug\text_class.exe' has exited with code 0 (0x0).
Is there a better, more user friendly compiler that I could use that would be able to step through the code properly? I can't seem to get VC++ to do it
Thanks again,
lordmickel
|
|
|
|
|
lordmickel wrote:
Is there a better, more user friendly compiler that I could use
No.
lordmickel wrote:
that would be able to step through the code properly? I
The problem is not the compiler
Use F9 to set breakpoints ( they look like a big black circle on the left margin, make sure you're building a debug version and hit F5. Then VC++ will stop at the breakpoint and allow you to step through the code, set and check variable values, etc.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
If you need to 'prove' that certain elements (an element of a list contains a value and a pointer to the next element) are members of a list, then the most effective way is to start from the header element and print the value of the 'next' pointer, which is the address of the next element. Then you would move into the next element, print it's address (which resolves to the same as the 'next' pointer on the previous cell), and print the value of this new element's 'next' pointer and move on again, repeating the process.
This will bring forth an effective way to prove that certain elements are linked to each other. It will not work for circularly linked lists, because the loop would never end. For a non-circular list, the last 'next' pointer is a NULL value.
However, I see no reason in 'proving' that the elements are members of a list. Why would anyone need to do such ? Isn't it enough if the list fills it's purpose, whatever that purpose might be ?
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
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;
}
|
|
|
|