News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

control handle

Started by drjr, July 19, 2007, 12:58:15 PM

Previous topic - Next topic

drjr

I have a ie: combobox, or static in a form and I want to know its handle. How can I do that.

   I have the following code

   invoke SendMessage,hWin,WM_SETTEXT,0,ADDR Mytext

Here hWin is the handle´s ie: textbox, but I don`t know how to get that hWin value.

    regards.


ragdog

hi drjr

you can get the handle from a window or any form with a spy tool
i like spy++ from visual studio or windowshack

greets
ragdog

[attachment deleted by admin]

SideSwipe

Hello:

To get the handle to any control on a dialog box form you must know its ID number. Then use the GetDlgItem API function to retrieve the handle like this:

.const
COMBOBOX1 equ 1000 ; this is the combobox control ID

.data?
hCB  dd  ? ; storage variable for the combobox handle that you wish to get

.data
Mytest db "this is a test",0

invoke GetDlgItem,hWin,COMBOBOX1 ; get the handle to the combobox, hWin in this case is the handle of the dialog box or form that houses the combobox control.
mov hCB,eax  ; save the handle for later use.

invoke SendMessage,hCB,WM_SETTEXT,0,ADDR Mytext

Regards,
SS

"Crashing through life !"

Jackal

if your using CreateWindowEx or CreateWindow you would do it like this.


      invoke CreateWindowEx,NULL,ADDR Static, NULL,WS_CHILD+WS_VISIBLE, 5, 110, 242, 15,hWnd,2,hInstance,NULL
      mov hStatic,eax