Function Reference


Retrieves the handle of a control in the specified dialog box

#include <WinAPISysWin.au3>
_WinAPI_GetDlgItem ( $hWnd, $iItemID )


$hWnd Handle to the dialog box
$iItemID Specifies the identifier of the control to be retrieved

Return Value

Success: The window handle of the given control
Failure: 0, call _WinAPI_GetLastError() to get extended error information


You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes.
As long as the $hWnd parameter specifies a parent window and the child window has a unique identifier, GetDlgItem returns a valid handle to the child window.

See Also

Search GetDlgItem in MSDN Library.


#include <MsgBoxConstants.au3>
#include <WinAPISysWin.au3>


Func Example()
    Local $hWnd, $idButton
    $hWnd = GUICreate("test")
    $idButton = GUICtrlCreateButton("button", 0, 0)
    MsgBox($MB_SYSTEMMODAL, "Handle", "Get Dialog Item: " & _WinAPI_GetDlgItem($hWnd, $idButton))
EndFunc   ;==>Example