Function Reference


_GUICtrlMenu_GetItemState

Retrieves the menu item state

#include <GuiMenu.au3>
_GUICtrlMenu_GetItemState ( $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

Returns the Menu item type. Can be one or more of the following:
    1 - Item is checked
    2 - Item is the default item
    4 - Item is disabled
    8 - Item is grayed
    16 - Item is highlighted

Related

_GUICtrlMenu_GetItemStateEx, _GUICtrlMenu_SetItemState

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 Open item state
        _GUICtrlMenu_SetItemChecked($hFile, 1)
        Writeln("Open item state: " & _GUICtrlMenu_GetItemState($hFile, 1))
EndFunc   ;==>Example

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