Retrieves the menu flags associated with the specified menu item
#include <GuiMenu.au3>
_GUICtrlMenu_GetItemStateEx ( $hMenu, $iItem [, $bByPos = True] )
$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 |
Success: | If the menu item opens a submenu the low-order byte of the return value contains the menu flags associated with the item, and the high-order byte contains the number of items in the submenu opened by the item. Otherwise, the return value is a mask of the menu flags. |
Failure: | -1 |
_GUICtrlMenu_GetItemState, _GUICtrlMenu_SetItemState
#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 Open item state
_GUICtrlMenu_SetItemState($hFile, 1, $MFS_CHECKED)
Writeln("Open item state: " & _GUICtrlMenu_GetItemStateEx($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