禁止和允许键盘按键

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
禁止和允许键盘,需要一个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.
有一些组合键不能屏蔽掉,例如Ctrl+Alt+Del!使用这个有可能导致蓝屏~~~~~~~~:(,你自己看着办吧。
 
后退
顶部