来个另类的思路。
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 442, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 320, 328, 113, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
If WinActive("Form1") Then
If _IsPressed("7B") Then Exit;当前窗口如果活动,热键F12退出程序
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
|