Function Reference

_GUICtrlMenu_GetItemStateEx

指定されたメニューアイテムに関連付けられたメニューフラグを取得します。

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemStateEx($hMenu, $iItem[, $fByPos = True])

 

パラメータ

$hMenu メニューのハンドル
$iItem メニューアイテムの位置または識別子
$fByPos [オプション]メニュー識別子フラグ:
 True - $iItemはゼロ始まりのアイテム位置です
False - $iItemはメニューアイテムの識別子です

 

返し値

成功: メニューアイテムがサブメニューを開いた場合は返し値の下位バイトにはアイテムに関連付けられたメニューフラグが、上位バイトにはアイテムによって開かれたサブメニュー内のアイテム数が格納されています。それ以外の場合は返し値はメニューフラグのマスクです。
失敗: -1

 

注意

なし。

 

関連

_GUICtrlMenu_SetItemState, _GUICtrlMenu_GetItemState

 


#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_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)

    ; "開く"アイテムの状態を取得/設定
    _GUICtrlMenu_SetItemState($hFile, 1, $MFS_CHECKED)
    Writeln("Open item state: " & _GUICtrlMenu_GetItemStateEx($hFile, 1))

EndFunc   ;==>_Main

; メモ帳にテキストを1行書き込む
Func Writeln($sText)
    ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc   ;==>Writeln