Retrieves information about the specified menu bar
#include <GuiMenu.au3>
_GUICtrlMenu_GetMenuBarInfo ( $hWnd [, $iItem = 0 [, $iObject = 1]] )
$hWnd | Handle to the window whose information is to be retrieved |
$iItem | [optional] Specifies the item for which to retrieve information. If 0, the function retrieves information about the menu itself. If 1, the function retrieves information about the first item on the menu, and so on. |
$iObject | [optional] Specifies the menu object: 0 - The popup menu associated with the window 1 - The menu bar associated with the window 2 - The system menu associated with the window |
Success: | 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 [4] - Handle to the menu bar or popup menu [5] - Handle to the submenu [6] - True if the menu bar has focus, otherwise False [7] - True if the menu item has focus, otherwise False |
Failure: | sets the @error flag to non-zero. |
Search GetMenuBarInfo in MSDN Library.
#include <GuiMenu.au3>
Example()
Func Example()
Local $hWnd, $aInfo
; Open Notepad
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
; Get menu bar info
$aInfo = _GUICtrlMenu_GetMenuBarInfo($hWnd)
Writeln("Left ............: " & $aInfo[0])
Writeln("Top .............: " & $aInfo[1])
Writeln("Right ...........: " & $aInfo[2])
Writeln("Bottom ..........: " & $aInfo[3])
Writeln("Menu handle .....: 0x" & Hex($aInfo[4]))
Writeln("Submenu Handle ..: 0x" & Hex($aInfo[5]))
Writeln("Menu bar focused : " & $aInfo[6])
Writeln("Menu item focused: " & $aInfo[7])
EndFunc ;==>Example
; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CRLF)
EndFunc ;==>Writeln