Function Reference


Returns the identifier of the specified control

#include <WinAPIDlg.au3>
_WinAPI_GetDlgCtrlID ( $hWnd )


$hWnd Handle to the control

Return Value

Success: Identifier of the control
Failure: 0, call _WinAPI_GetLastError() to get extended error information


GetDlgCtrlID accepts child window handles as well as handles of controls in dialog boxes.
An application sets the identifier for a child window when it creates the window by assigning the identifier value to the hmenu parameter when calling the CreateWindow or CreateWindowEx function.
Although GetDlgCtrlID may return a value if $hWnd identifies a top-level window, top-level windows cannot have identifiers and such a return value is never valid.

See Also

Search GetDlgCtrlID in MSDN Library.


#include <MsgBoxConstants.au3>
#include <WinAPIDlg.au3>


Func Example()
    Local $idButton
    $idButton = GUICtrlCreateButton("testing", 0, 0)
    MsgBox($MB_SYSTEMMODAL, "ID", "Dialog Control ID: " & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($idButton)))
EndFunc   ;==>Example