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 "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