B
BlueFish
Unregistered / Unconfirmed
GUEST, unregistred user!
为什么我编的一个键盘监控的程序,键盘消息被Hook 截获后,不能传递给<br>Windows原来的处理过程,程序主要过程:<br>function KeyboardHook(iCode:integer;wParam:WPARAM;<br> lParam:LPARAM):LRESULT;stdcall;export;<br>const<br> _KeyPressMask = $80000000;<br>var<br> tmpReg:TRegistry;<br> RecordFile:TextFile;<br>begin<br> result:=0;<br> if iCode<0 then<br> begin<br> CallNextHookEx(hNextHookProc,iCode,wParam,lParam);<br> exit;<br> end;<br> if ((lParam and _KeyPressMask) = 0) then<br> begin<br> AssignFile(RecordFile,FilePath);<br> Append(RecordFile);<br> write(RecordFile,char(wparam));<br> if GetKeyState(VK_RETURN)<0 then<br> begin<br> writeln(RecordFile);<br> write(RecordFile,char(wparam));<br> end;<br> Closefile(RecordFile);<br> end;<br> MessageDlg(inttostr(hNextHookProc),mtInformation,[mbok],0);<br> CallNextHookEx(hNextHookProc,iCode,wParam,lParam);<br> result:=1;<br>end;<br><br> 弹出的窗口显示hNextHookProc的值为0,而在该过程外值为一非零值<br>顺便问一下,如何使程序每1ms执行一个动作.