Function Reference


_GUICtrlMenu_SetItemGrayed

Sets the grayed state of a menu item

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

Parameters

$hMenu Menu handle
$iItem Identifier or position of the menu item
$bState [optional] Item state to set:
    True - State is enabled
    False - State is disabled
$bByPos [optional] Menu identifier flag:
    True - $iItem is a 0-based item position
    False - $iItem is a menu item identifier

Return Value

Success: True.
Failure: False.

Related

_GUICtrlMenu_GetItemGrayed

Example

#include <GuiMenu.au3>

Example()

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

        ; Open Notepad
        Run("notepad.exe")
        WinWaitActive("[CLASS:Notepad]")
        $hWnd = WinGetHandle("[CLASS:Notepad]")
        $hMain = _GUICtrlMenu_GetMenu($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))
EndFunc   ;==>Example

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