向指定的 Dummy(虚拟) 控件发送消息
GUICtrlSendToDummy ( 控件ID [, 状态] )
控件ID | 控件标识符(控件ID),可由 GUICtrlCreateDummy 的返回值获得. |
状态 | [可选参数] 可在稍后(的脚本语句中)能使用由 GUICtrlRead 读取的值. |
成功: | 返回值为1. |
失败: | 返回值为0. |
#include <GUIConstantsEx.au3>
Global $iUserDummy
Example()
Func Example()
Opt("GUIOnEventMode", 1) ; Set the option to use GUIOnEventMode.
GUICreate("GUISendToDummy", 220, 200, 100, 200)
GUISetBkColor(0x00E0FFFF) ; Change the background color of the GUI.
GUISetOnEvent($GUI_EVENT_CLOSE, "OnClick") ; Set an event to call the 'OnClick' function when the GUI close button is selected.
$iUserDummy = GUICtrlCreateDummy()
GUICtrlSetOnEvent(-1, "OnExit") ; Set an event to call the 'OnExit' function when this control is selected.
GUICtrlCreateButton("Close", 70, 170, 85, 25)
GUICtrlSetOnEvent(-1, "OnClick") ; Set an event to call the 'OnClick' function when this control is selected.
; Display the GUI.
GUISetState(@SW_SHOW)
While 1
Sleep(100)
WEnd
EndFunc ;==>Example
Func OnClick()
Return GUICtrlSendToDummy($iUserDummy) ; Send a message to the dummy control that the close button was selected, which will then proceed to call the function 'OnExit'.
EndFunc ;==>OnClick
Func OnExit()
Exit ; Exit the script.
EndFunc ;==>OnExit