Function Reference


_GUICtrlMenu_GetItemCount

Retrieves the number of items in the specified menu

#include <GuiMenu.au3>
_GUICtrlMenu_GetItemCount ( $hMenu )

Parameters

$hMenu Handle of the menu

Return Value

Success: the number of items in the menu.
Failure: -1.

See Also

Search GetMenuItemCount in MSDN Library.

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)

    ; Show Main menu item count
    Writeln("Main menu item count: " & _GUICtrlMenu_GetItemCount($hMain))
EndFunc   ;==>Example

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