# Function Reference

# _GUICtrlMenu_GetMenuBarInfo

Retrieves information about the specified menu bar

#include <GuiMenu.au3>
_GUICtrlMenu_GetMenuBarInfo ( $hWnd [, $iItem = 0 [, $iObject = 1]] )

## Parameters

$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

## Return Value

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.

## See Also

Search GetMenuBarInfo in MSDN Library.

## Example

    #include "Extras\HelpFileInternals.au3"

    #include <GuiMenu.au3>

    Global $g_hWnd

    Example()

    Func Example()
        Local $aInfo

        ; Open Notepad
        Run("notepad.exe")
        $g_hWnd = WinWaitActive("[CLASS:Notepad]")

        ; Get menu bar info
        $aInfo = _GUICtrlMenu_GetMenuBarInfo($g_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])

        _NotepadForceClose($g_hWnd)
    EndFunc   ;==>Example

    ; Write a line of text to Notepad
    Func Writeln($sText, $hWnd = $g_hWnd)
        ControlSend($hWnd, "", ControlGetFocus($hWnd), $sText & @CRLF)
    EndFunc   ;==>Writeln