这个资料你看一下
禁止和允许键盘,需要一个DLL来做到这一点:
Library KillKB;
Uses Wintypes, WinProcs
{$IFNDEF VER80}
,Win31
{$ENDIF}
;
Var
oldHook: HHook;
Function KbHook( code: Integer; wparam: Word; lparam: LongInt ): LongInt;
export;
Begin
If code < 0 Then
KbHook := CallNextHookEx( oldHook, code, wparam, lparam )
Else
KbHook := 1;
End; { KbHook }
Function DisableKeyboard: Boolean; export;
Begin
oldHook := SetWindowsHookEx( WH_KEYBOARD, KbHook, HInstance, 0 );
DisableKeyboard := oldHook <> 0;
End;
Procedure EnableKeyboard; export;
Begin
If oldHook <> 0 Then Begin
UnhookWindowshookEx( oldHook );
oldHook := 0;
End; { If }
End;
exports
DisableKeyboard index 1,
EnableKeyboard index 2;
Begin
oldHook := 0;
End.