没分了,把分给我吧! (XP + D6 调试通过)<br><br>unit LockTheKB;<br>//锁键盘单元 <br>interface<br>uses<br> Wintypes, WinProcs;<br><br> //键盘上锁<br> Function DisableKeyboard: Boolean;<br> //键盘解锁<br> Procedure EnableKeyboard;<br><br>implementation<br><br>var<br> oldHook: Hhook;<br><br>Function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LongInt;export;<br>Begin<br> If code < 0 Then<br> KbHook := CallNextHookEx( oldHook, code, wparam, lparam )<br> Else<br> KbHook := 1;<br>End; // KbHook<br><br>Function DisableKeyboard: Boolean;<br>//上锁<br>Begin<br> oldHook := SetWindowsHookEx( WH_KEYBOARD, @KbHook, Hinstance, 0 );<br> DisableKeyboard := oldHook <> 0;<br>End;<br><br>Procedure EnableKeyboard;<br>//解锁<br>Begin<br> If oldHook <> 0 Then<br> Begin<br> UnhookWindowshookEx( oldHook );<br> oldHook := 0;<br> End; // If<br>End;<br>end.<br>