au3代码 GUICtrlMenu Click
GUICtrlMenu Click is not a valid AutoIt function.
However, to simulate a click on a menu item in AutoIt, you can use the GUICtrlSendMsg function with the appropriate message and parameters.
Here's an example code that clicks on a menu item with the index 1 in a GUI:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $hGUI, $hMenu
$hGUI = GUICreate("AutoIt Menu Example", 300, 200)
$hMenu = GUICtrlCreateMenu("File")
GUICtrlCreateMenuItem("Open", $hMenu)
GUICtrlCreateMenuItem("Save", $hMenu)
GUICtrlCreateMenuItem("", $hMenu)
GUICtrlCreateMenuItem("Exit", $hMenu)
GUISetState(@SW_SHOW)
; Simulate click on the first menu item
GUICtrlSendMsg($hMenu, $WM_COMMAND, GUICtrlGetHandle($hMenu) + 1, 0)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
In the above code, the GUICtrlSendMsg function is used to send a message to the menu control. The message is $WM_COMMAND, which represents a command message. The parameters for the message are the handle of the menu control and the identifier of the menu item to click. In this case, the identifier is obtained by adding 1 to the handle of the menu control
原文地址: https://www.cveoy.top/t/topic/iBnm 著作权归作者所有。请勿转载和采集!