Hi all,
Is this the correct way to populate a list box, as it doesn't seem to be working for me?
1002 (IDC_LST1) is the number of the list box. Classname is just a db with some text in it. Unfortunately it does not make an appearace in the list box. hWin is the dialogue box in which the list box resides.
Is this the correct way to populate a list box, as it doesn't seem to be working for me?
1002 (IDC_LST1) is the number of the list box. Classname is just a db with some text in it. Unfortunately it does not make an appearace in the list box. hWin is the dialogue box in which the list box resides.
WndProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
mov eax,uMsg
.if eax==WM_INITDIALOG
push hWin
pop hWnd
invoke LoadIcon,hInstance,500
mov hIcon,eax
invoke SendMessage,hWin,WM_SETICON,NULL,hIcon
invoke SendDlgItemMessage,hWin,1002,ClassName,NULL,NULL
.elseif eax==WM_COMMAND
mov eax,wParam
and eax,0FFFFh
Hello WongDai,
To populate listbox use:
handle must be handle to listbox not to dialog box.
best regards,
czDrillard
To populate listbox use:
invoke SendMessage,hListBox,LB_ADDSTRING,0,ADDR ClassName
handle must be handle to listbox not to dialog box.
best regards,
czDrillard
Thankyou czDrillard
I am using RadASM, and as such the listbox is created in the dialogue editor. I can see in the code where the actual dialogue box is created and thus know its handle is in hWin.
How can I determine the handle of the listbox as it is created in the resource file?
Sorry for my noobness.
Wongdai
I am using RadASM, and as such the listbox is created in the dialogue editor. I can see in the code where the actual dialogue box is created and thus know its handle is in hWin.
How can I determine the handle of the listbox as it is created in the resource file?
Sorry for my noobness.
Wongdai
Hello WongDai,
Not necessary to apologize :lol:
Listbox handle is returned in eax
best regards,
czDrillard
Not necessary to apologize :lol:
invoke GetDlgItem,hWin,1002
Listbox handle is returned in eax
best regards,
czDrillard
Aha! It works!
Thanks mate - well done.
Two wins in the first week of 2006. W00t.
Wongdai
Thanks mate - well done.
Two wins in the first week of 2006. W00t.
Wongdai
Hi,
You can also just skip a step and use SendDlgItemMessage, it will take the handle of the dialog and the ID of the listbox. Generally that's what I tend to use unless I need to use it outside the message loop.
You can also just skip a step and use SendDlgItemMessage, it will take the handle of the dialog and the ID of the listbox. Generally that's what I tend to use unless I need to use it outside the message loop.
Good one!
Thanks for the tip Donkey.
Thanks for the tip Donkey.