Advertisement

STUPID COMBOBOXES

Started by December 18, 2000 04:02 PM
4 comments, last by jt_845s 24 years ago
could someone please explain how to add a string to a combo box in pure Win32?
  #define ignite_software 1  
[source]#define ignite_software 1[/source]
Send the CB_ADDSTRING message to the control with lParam pointing to the string that is to be added.


Steve ''Sly'' Williams
Tools Developer
Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Advertisement
tried it. don''t seem to work? maybe someone could give me a working example?

  #define ignite_software 1  
[source]#define ignite_software 1[/source]
The easiest way to do it is to include windowsx.h, a header file which contains tons of convenience macros; among other things, it contains macros for messing with controls. So, here's what you need to use to add a string using those macros:

    ComboBox_AddString(GetDlgItem(hWnd, IDC_COMBO_ID), "a string");  


The GetDlgItem function returns the HWND for a specific control. The first parameter it takes is the HWND of the window containing the control--in your case, I assume it's a dialog. The second parameter is the control's ID. Make sure you've included resource.hand use the constant name you entered for the control in the dialog editor. That's really all there is to it.

In many of my projects, I've put this stuff in the WM_INITDIALOG block of my dialog's window procedure's switch thingy.

Hope that helps.

Edited by - merlin9x9 on December 18, 2000 8:39:59 PM
still nothing. maybe something is wrong with the way i recieved the combo box. i used GetDlgItem to store a global hwnd for the control.

  #define ignite_software 1  
[source]#define ignite_software 1[/source]
test if your hwnd is valid ..

next, iv you use visualc (what i think you do), and you did it in the resource-editor, your string is sent and all worked, but your combobox has the highscale 0 (not very much). go in the resourceeditor and click on your combo to "open" it. then go on the bottom of it and you can "scale it".. do this.. just alittle.. or more, not important, but then it should work fine (and scales automatically)

we wanna play, not watch the pictures

If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia

My Page davepermen.net | My Music on Bandcamp and on Soundcloud

This topic is closed to new replies.

Advertisement