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 "Extras\HelpFileInternals.au3"

#include <GuiMenu.au3>

Global $g_hWnd

Example()

Func Example()
    Local $hMain

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

    ; Show Main menu item count
    Writeln("Main menu item count: " & _GUICtrlMenu_GetItemCount($hMain))

    _NotepadForceClose($g_hWnd)
EndFunc   ;==>Example

; Write a line of text to Notepad
Func Writeln($sText, $hWnd = $g_hWnd)
    ControlSend($hWnd, "", ControlGetFocus($hWnd), $sText & @CRLF)
EndFunc   ;==>Writeln