Function Reference


_GUICtrlMenu_SetItemInfo

Changes information about a menu item

#include <GuiMenu.au3>
_GUICtrlMenu_SetItemInfo ( $hMenu, $iItem, ByRef $tInfo [, $bByPos = True] )

Parameters

$hMenu Menu handle
$iItem Identifier or position of the menu item
$tInfo $tagMENUITEMINFO structure
$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

$tagMENUITEMINFO, _GUICtrlMenu_GetItemInfo

See Also

Search SetMenuItemInfo in MSDN Library.

Example

#include <GuiMenu.au3>

Example()

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

    ; Open Notepad
    Run("notepad.exe")
    WinWaitActive("[CLASS:Notepad]")
    $hWnd = WinGetHandle("[CLASS:Notepad]")
    $hMain = _GUICtrlMenu_GetMenu($hWnd)
    $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

    ; Get/Set Open command ID
    $tInfo = _GUICtrlMenu_GetItemInfo($hFile, 1)
    Writeln("Open command ID: " & DllStructGetData($tInfo, "ID"))
    DllStructSetData($tInfo, "ID", 0)
    _GUICtrlMenu_SetItemInfo($hFile, 1, $tInfo)
    $tInfo = _GUICtrlMenu_GetItemInfo($hFile, 1)
    Writeln("Open command ID: " & DllStructGetData($tInfo, "ID"))
EndFunc   ;==>Example

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