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.
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.
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
ret
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.
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...
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...
indeed,
specify the hWnd handler of the window with the combobox as a parameter in your proc and use it in the GetDlgItem api.
specify the hWnd handler of the window with the combobox as a parameter in your proc and use it in the GetDlgItem api.
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?
One more question then...
What is the easiest way to make hWnd "global" so that other procs can use it?
.data?
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.
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.
Thank you folks very much. I appreciate this and problem fixed.