捕获窗口消息.
GUIGetMsg ( [高级模式] )
高级模式 | [可选参数] 以数组的形式返回扩展信息. 0 = (默认)只返回捕获的事件. 1 = 返回一个含有事件及扩展信息的数组. |
事件 ID | 控件发生的消息ID |
0 | 无事件 |
$GUI_EVENT_CLOSE | 对话框(窗口)正被关闭(相关按钮被点击或系统菜单项被选中). |
$GUI_EVENT_MINIMIZE | 对话框(窗口)被最小化(窗口标题栏上的最小化按钮被点击) |
$GUI_EVENT_RESTORE | 对话框(窗口)被还原(任务栏图标被点击) |
$GUI_EVENT_MAXIMIZE | 对话框(窗口)被最大化(窗口标题栏上的最大化按钮被点击) |
$GUI_EVENT_MOUSEMOVE | 鼠标光标被移动. |
$GUI_EVENT_PRIMARYDOWN | 鼠标的主要按钮被按下.(多指左键) |
$GUI_EVENT_PRIMARYUP | 鼠标的主要按钮被松开.(多指左键) |
$GUI_EVENT_SECONDARYDOWN | 鼠标的第二个按钮被按下.(多指右键) |
$GUI_EVENT_SECONDARYUP | 鼠标的第二个按钮被松开.(多指右键) |
$GUI_EVENT_RESIZED | 对话框大小改变. |
$GUI_EVENT_DROPPED | 拖放(Drag&Drop)操作结束,@GUI_DRAGID, @GUI_DRAGFILE 和 @GUI_DROPID 将用于返回 ID/文件 相应的控件. |
#include <GUIConstantsEx.au3>
Example()
;-------------------------------------------------------------------------------------
; Example - Press the button to see the value of the radio boxes
; The script also detects state changes (closed/minimized/timeouts, etc).
Func Example()
Local $button_1, $radio_1, $radio_3
Local $radioval1, $msg
Opt("GUICoordMode", 1)
GUICreate("Radio Box Demo", 400, 280)
; Create the controls
$button_1 = GUICtrlCreateButton("B&utton 1", 30, 20, 120, 40)
GUICtrlCreateGroup("Group 1", 30, 90, 165, 160)
GUIStartGroup()
$radio_1 = GUICtrlCreateRadio("Radio &0", 50, 120, 70, 20)
GUICtrlCreateRadio("Radio &1", 50, 150, 60, 20)
$radio_3 = GUICtrlCreateRadio("Radio &2", 50, 180, 60, 20)
; Init our vars that we will use to keep track of GUI events
$radioval1 = 0 ; We will assume 0 = first radio button selected, 2 = last button
; Show the GUI
GUISetState()
; In this message loop we use variables to keep track of changes to the radios, another
; way would be to use GUICtrlRead() at the end to read in the state of each control
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
MsgBox(0, "", "Dialog was closed")
Exit
Case $msg = $GUI_EVENT_MINIMIZE
MsgBox(0, "", "Dialog minimized", 2)
Case $msg = $GUI_EVENT_MAXIMIZE
MsgBox(0, "", "Dialog restored", 2)
Case $msg = $button_1
MsgBox(0, "Default button clicked", "Radio " & $radioval1)
Case $msg >= $radio_1 And $msg <= $radio_3
$radioval1 = $msg - $radio_1
EndSelect
WEnd
EndFunc ;==>Example