Это отключение клавиатуры
Код:
function KBHookHandler(ACode: Integer; WParam: WParam; LParam: LParam)
: LResult; stdcall;
begin
if ACode < 0 then
// Immediately pass the event to next hook
Result := CallNextHookEx(Hook, ACode, WParam, LParam)
else
// by setting Result to values other than 0 means we drop/erase the event
Result := 1;
end;
function DisableKeyboard : boolean;
begin
if Hook = 0 then
// install the hook
// Hook := SetWindowsHookEx(WH_KEYBOARD, @KBHookHandler, HINSTANCE, 0);
Hook := SetWindowsHookEx(WH_KEYBOARD, @KBHookHandler, 0, 0);
Result := Hook <> 0;
end;
а включение будет так?
Код:
function EnableKeyboard : boolean;
begin
if Hook = 0 then
// install the hook
// Hook := SetWindowsHookEx(WH_KEYBOARD, @KBHookHandler, HINSTANCE, 0);
Hook := SetWindowsHookEx(WH_KEYBOARD, @KBHookHandler, 1, 0);
Result := Hook <> 0;
end;
Попробовал.Не отключается.
Может использовать JvHidControllerClass.pas? Только выдается ошибка при использовании данной библиотеки.Не могу корректно установить компоненты JEDI