修改类我不会
倒是会截取WM_CLOSE消息
借几位大大的代码改一下成果如下
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
Local $iPid
Dim $hWndProc = DLLCallbackRegister ("WindowCallback", "int", "hwnd;int;wparam;lparam")
Dim $pCallback = DllCallbackGetPtr($hWndProc)
Dim $gWndProc
$AutoItPID = @AutoItPID
$var = WinList("[CLASS:AutoIt v3]")
For $i = 1 To $var[0][0]
$hWnd = $var[$i][1] ;hwnd
_WinAPI_GetWindowThreadProcessId($hWnd, $iPid)
If $iPid = $AutoItPID Then
$gWndProc = _WinAPI_GetWindowLong($hWnd, -4)
_WinAPI_SetWindowLong($hWnd,-4, $pCallback)
ExitLoop
EndIf
Next
$F = GUICreate("Form1", 293, 181, 193, 125)
$L = GUICtrlCreateLabel("Test", 64, 40, 141, 68)
GUICtrlSetFont(-1, 30, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func WindowCallback($hWnd, $iMsg, $wParam, $lParam)
Switch $iMsg
Case $WM_CLOSE
Return 0
EndSwitch
Return _WinAPI_CallWindowProc($gWndProc,$hWnd, $iMsg, $wParam, $lParam)
EndFunc ;==>WindowCallback
|