Function Reference


ControlGetHandle

Retrieves the internal handle of a control.

ControlGetHandle ( "title", "text", controlID )

Parameters

title The title/hWnd/class of the window to access. See Title special definition.
text The text of the window to access. See Text special definition.
controlID The control to interact with. See Controls.

Return Value

Success: the handle (HWND) value.
Failure: 0 and sets the @error flag to non-zero if no window matches the criteria.

Remarks

This function returns a HWND/Handle value.

Example

#include <MsgBoxConstants.au3>

Example()

Func Example()
        ; Run Notepad
        Run("notepad.exe")

        ; Wait 10 seconds for the Notepad window to appear.
        Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)

        ; Retrieve the handle of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetHandle.
        Local $hControl = ControlGetHandle($hWnd, "", "Edit1")

        ; Display the handle of the edit control.
        MsgBox($MB_SYSTEMMODAL, "", "The handle of Edit1 is: " & $hControl)

        ; Close the Notepad window using the handle returned by WinWait.
        WinClose($hWnd)
EndFunc   ;==>Example