Показать сообщение отдельно
  #7  
Старый 31.08.2023, 07:04
infopol infopol вне форума
Прохожий
 
Регистрация: 03.06.2021
Сообщения: 35
Версия Delphi: Delphi 7
Репутация: 10
По умолчанию Я так понял

Это отключение клавиатуры

Код:
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
Ответить с цитированием