S
sy0116
Unregistered / Unconfirmed
GUEST, unregistred user!
我想在一个DLL文件中实现一个在系统关机、重启、注销前保存数据的功能,想用GetMessage钩子来得到,于是写了以下代码,可是一点用也没有,请问这是为什么<br>MsgHook:=SetWindowsHookEx(WH_GETMESSAGE,@MsgProc,0,GetCurrentThreadId);<br><br>function MsgProc(ncode,wparam,lparam:Integer):LRESULT;stdcall;<br>var<br> mess:Cardinal;<br>begin<br> mess:=pmsg(lparam)^.message;<br> if (mess=WM_QUERYENDSESSION) or (mess=WM_ENDSESSION) or (mess=ENDSESSION_LOGOFF)then<br> begin<br> SaveInfo;<br> end;<br> Result:=CallNextHookEx(msgHook,ncode,wparam,lparam);<br>end;