# Function Reference

# _WinAPI_GetDlgItem

Retrieves the handle of a control in the specified dialog box

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

## Parameters

$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

## Remarks

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.

## Example

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

    Example()

    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