Retrieves the number of items in the specified menu
#include <GuiMenu.au3>
_GUICtrlMenu_GetItemCount ( $hMenu )
$hMenu | Handle of the menu |
Success: | the number of items in the menu. |
Failure: | -1. |
Search GetMenuItemCount in MSDN Library.
#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