C
ch2001023
Unregistered / Unconfirmed
GUEST, unregistred user!
const WM_CloseHook = WM_User + 100; //自定义消息,主程序,和DLL必须申明PostMessage(Handle, WM_CloseHook, 0, 0); //Handle 为主程序句柄。WmHook := SetWindowsHookEx(WH_GETMESSAGE,@WMHookPRO, HInstance, 0);//配合PostMessage使用{回调函数}function WMHookPRO(nCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;begin if nCode = HC_ACTION then if PMsg(lParam)^.message = WM_CloseHook then begin .... end; Result := CallNextHookEx(WmHook, nCode, wParam, lParam);end;