Function Reference


_WinAPI_GetDlgCtrlID

Returns the identifier of the specified control

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

Parameters

$hWnd Handle to the control

Return Value

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

Remarks

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.

Example

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

Example()

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