如何能用API锁定键盘? (100分)

谢谢各位!
 
普通钩子<br>=============================动态连接库代码<br>library DllP;<br>&nbsp; uses windows;<br>&nbsp; procedure HookOn;stdcall;<br>&nbsp; procedure HookOff;stdcall;<br>var<br>&nbsp; HookH:HHook; &nbsp; &nbsp;//钩子句柄<br>function keyhook(Code:Integer;wParam:WPARAM;lParam:LPARAM):LRESULT;stdcall;<br>begin<br>&nbsp; Result:=1; //强行 屏蔽<br>end;<br><br>procedure HookOn;<br>begin<br>&nbsp; HooKH:=SetWindowsHookEx(WH_KEYBOARD,keyHook,HInstance,0);<br>end;<br><br>procedure HookOff;<br>begin<br>&nbsp; UnHookWindowsHookEx(HookH);<br>end;<br><br>exports<br>&nbsp; HookOn,HookOff;<br>begin<br>end.<br><br>============================在exe中这样:<br>procedure &nbsp;HookOn ; stdcall; external 'DllP.dll';<br>procedure HookOff ; stdcall; external 'DllP.dll'; <br><br>&nbsp; &nbsp; hookon; //挂键盘钩子
 
顶部