Function Reference


_GUICtrlMenu_GetItemData

Retrieves the application defined value associated with the menu item

#include <GuiMenu.au3>
_GUICtrlMenu_GetItemData ( $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 application defined value associated with the menu item.

Related

_GUICtrlMenu_SetItemData

Example

#include <GuiMenu.au3>

Example()

Func Example()
    Local $hWnd, $hMain

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

    ; Get/Set File menu item data
    Writeln("File menu item data: " & _GUICtrlMenu_GetItemData($hMain, 0))
    _GUICtrlMenu_SetItemData($hMain, 0, 1234)
    Writeln("File menu item data: " & _GUICtrlMenu_GetItemData($hMain, 0))
EndFunc   ;==>Example

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