检索菜单项灰色状态
#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemGrayed($hMenu, $iItem [, $fByPos = True])
$hMenu | 菜单句柄 |
$iItem | 菜单项的标识符或位置,由 $fByPos 参数决定. |
$fByPos | [可选参数] 菜单识别标志: True - $iItem 为项目的 0 基位置 False - $iItem 为菜单项的标识符 |
True: | 项目为灰色 |
False: | 项目不是灰色 |
#include <GuiMenu.au3>
_Main()
Func _Main()
Local $hWnd, $hMain, $hFile
; 打开记事本
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 ;==>_Main
; 写入一行文本到记事本
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln