Okay, been kicking this thing around for a few days now. I read how to fill the ComboBox with strings and such, but it does not work if I call it from an outside PROC.

VolumeSize PROC
invoke GetDlgItem, 0, IDC_CBO1
mov hCombo, eax

invoke SendMessage, hCombo, CB_ADDSTRING, 0, CStr("This thing is finally working!")
invoke SendMessage, hCombo, CB_SETCURSEL, 0, 0
VolumeSize endp

I am calling this when WM_INITDIALOG is initiated in the program start.

Any ideas WHY this refuses to fill the ComboBox?

Many thanks in advance folks.
Posted on 2004-07-23 14:57:09 by The Beginner
GetDlgItem, 0, IDC_CBO1

So you are trying to find the IDC_CBO1 Combo Box on the Dialog with an HWND of 0?
I am almost sure you need the Dialog HWND in the first parameter, not 0...
Posted on 2004-07-23 16:59:13 by Graebel
specify the hWnd handler of the window with the combobox as a parameter in your proc and use it in the GetDlgItem api.
Posted on 2004-07-23 18:08:27 by wizzra
Okay, I see now. Thank you for clearing that up.

One more question then...

What is the easiest way to make hWnd "global" so that other procs can use it?
Posted on 2004-07-24 07:47:13 by The Beginner
g_hWnd dd ?

in your main proc just store the hWnd to g_hWnd (push hWnd,pop g_hWnd)
that way you can use it in any procs in your app.
Posted on 2004-07-24 11:47:51 by wizzra
Thank you folks very much. I appreciate this and problem fixed.
Posted on 2004-07-24 23:43:34 by The Beginner