設置快捷方式.
GUISetAccelerators ( 加速鍵 [, 句柄] )
加速鍵 | 存儲快捷方式信息的 2 維數(shù)組 (見備注). |
句柄 | [可選參數(shù)] 由 GUICreate() 函數(shù)返回的窗口句柄 (默認為先前使用的窗口). |
成功: | 返回 1. |
失敗: | 返回 0. |
; 一個簡單的自定義 MessageBox 示例,
使用消息循環(huán)模式
#include <GUIConstantsEx.au3>
GUICreate("自定義 Msgbox", 210,
80)
GUICtrlCreateLabel("請按一下按鈕!", 10,
10)
Local $YesID
= GUICtrlCreateButton("是",
10, 50, 50, 20)
Local $NoID
= GUICtrlCreateButton("否",
80, 50, 50, 20)
Local $ExitID
= GUICtrlCreateButton("退出",
150, 50, 50, 20)
; 設置 Ctrl + Y 和 Ctrl + N 快捷鍵
Local $AccelKeys[2][2] =
[["^y", $YesID],["^n", $NoID]]
GUISetAccelerators($AccelKeys)
GUISetState()
; 顯示 GUI
Do
Local
$msg = GUIGetMsg()
Select
Case $msg = $YesID
MsgBox(0, 0, "你點擊了:是")
Case $msg = $NoID
MsgBox(0, 0, "你點擊了:否")
Case $msg = $ExitID
MsgBox(0, 0, "你點擊了:退出")
Case $msg = $GUI_EVENT_CLOSE
MsgBox(0, 0, "你點擊了:關閉")
EndSelect
Until $msg
= $GUI_EVENT_CLOSE
Or $msg
= $ExitID
provider with jb51.net (unicode) |