# Function Reference

# _GUICtrlMenu_GetItemGrayed

Retrieves the status of the menu item grayed state

#include <GuiMenu.au3>
_GUICtrlMenu_GetItemGrayed ( $hMenu, $iItem [, $bByPos = True] )

## Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$bByPos | [optional] Menu identifier flag: True - $iItem is a 0-based item position False - $iItem is a menu item identifier

## Return Value

True: | $iItem is grayed.
False: | $iItem is not grayed.

## Related

_GUICtrlMenu_SetItemGrayed

## Example

    #include "Extras\HelpFileInternals.au3"

    #include <GuiMenu.au3>

    Global $g_hWnd

    Example()

    Func Example()
        Local $hMain, $hFile

        ; Open Notepad
        Run("notepad.exe")
        $g_hWnd = WinWaitActive("[CLASS:Notepad]")
        $hMain = _GUICtrlMenu_GetMenu($g_hWnd)
        $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

        ; Get/Set Open grayed
        Writeln("Open is grayed: " & _GUICtrlMenu_GetItemGrayed($hFile, 1))
        _GUICtrlMenu_SetItemGrayed($hFile, 1)
        Writeln("Open is grayed: " & _GUICtrlMenu_GetItemGrayed($hFile, 1))

        _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