Hey all,
I have a need to retrieve the ID of a control in a dialog box. I have the dialog window handle and I know the text in the control that I need the ID of.
I used Spy++ and saw the ID changes each launch, which I didn't know happened. Wondered if there was an API I overlooked that can help me find this button's ID.
Thanks in advance!
-brixton
Hey, Brixton! :bg
You can use this:
1. FindWindowEx() — The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window. This function does not perform a case-sensitive search.
2. GetDlgCtrlID() — The GetDlgCtrlID function retrieves the identifier of the specified control.
Hey KSS and thanks for the reply!
QuoteYou can use this:
1. FindWindowEx() — The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window. This function does not perform a case-sensitive search.
Can I use FindWindowEx for a control? Cool!
Thanks, I'll give it a go,
-brixton
Hey thanks, I have it now working completely fully! There is a window and when I CreateProcess it, I needed to get the window handle of its child which is always sitting 'on top' of it, and then find a specific button and send a click to it. So I produced the following which works:
...
mov handle, eax
push 3
push handle
call GetWindow
mov handle, eax
push OFFSET lpszWindow
push OFFSET classname
push NULL
push handle
call FindWindowEx
push eax
call GetDlgCtrlID
push NULL
push NULL
push 0F5h
push eax
push handle
call SendDlgItemMessage
...
Thanks for the help!
QuoteCan I use FindWindowEx for a control? Cool!
Any control (buttons, edits, etc.) is a
WINDOW, but subclassed by Windows (It not really true, but for simplest understand it true)
SDK for Windows are such as Bible for people!