除了钩子还有其他办法吗?
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPISys.au3>
Global Const $SC_MINIMIZE = 0xF020 ;最小化按钮
Global Const $SC_CLOSE = 0xF060 ;关闭按钮
GUIRegisterMsg($WM_SYSCOMMAND, 'WM_SYSCOMMAND')
$Gui = GUICreate("12", 440, 170)
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_MINIMIZE
EndSwitch
WEnd
Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
Switch BitAND($wParam, 0xFFFF)
Case $SC_MINIMIZE
MsgBox(0,0,0)
Case $SC_CLOSE
If BitAND(_WinAPI_GetAsyncKeyState(27), 0x8000) = 0 Then
Exit
Else
MsgBox(0, "_WinAPI_GetAsyncKeyState", "Esc 键被点击, 退出.")
Return 0
EndIf
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SYSCOMMAND
|