Function Reference


_GUICtrlMenu_GetItemRect

Retrieves the bounding rectangle for the specified menu item

#include <GuiMenu.au3>
_GUICtrlMenu_GetItemRect ( $hWnd, $hMenu, $iItem )

Parameters

$hWnd Handle to the window containing the menu
$hMenu Handle of the menu
$iItem 0-based position of the menu item

Return Value

Returns an array with the following format:
    [0] = X coordinate of the upper left corner of the rectangle
    [1] = Y coordinate of the upper left corner of the rectangle
    [2] = X coordinate of the lower right corner of the rectangle
    [3] = Y coordinate of the lower right corner of the rectangle

Related

_GUICtrlMenu_GetItemRectEx

Example

#include <GuiMenu.au3>

Example()

Func Example()
        Local $hWnd, $hMain, $aRect

        ; Open Notepad
        Run("notepad.exe")
        WinWaitActive("[CLASS:Notepad]")
        $hWnd = WinGetHandle("[CLASS:Notepad]")
        $hMain = _GUICtrlMenu_GetMenu($hWnd)

        ; Get File menu rectangle
        $aRect = _GUICtrlMenu_GetItemRect($hWnd, $hMain, 0)

        Writeln("File X1: " & $aRect[0])
        Writeln("File Y1: " & $aRect[1])
        Writeln("File X2: " & $aRect[2])
        Writeln("File Y2: " & $aRect[3])
EndFunc   ;==>Example

; Write a line of text to Notepad
Func Writeln($sText)
        ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CRLF)
EndFunc   ;==>Writeln