完全阻止键盘输入

use*_*767 0 windows delphi winapi kiosk-mode

有没有办法完全阻止键盘输入?这也应该阻止像WIN + E这样的关键组合.

我发现这个代码,无论如何要改变它只阻止键盘输入(鼠标需要工作)

    procedure TForm1.Button1Click(Sender: TObject) ;

   function FuncAvail(dllName, funcName: string; var p: pointer): boolean;
   var
     lib: THandle;
   begin
     result := false;
     p := nil;
     if LoadLibrary(PChar(dllName)) = 0 then exit;
     lib := GetModuleHandle(PChar(dllName)) ;
     if lib <> 0 then
     begin
      p := GetProcAddress(lib, PChar(funcName)) ;
      if p <> nil then Result := true;
     end;
   end;

   var
     BlockInput : function(Block: BOOL): BOOL; stdcall;

   begin
    if FuncAvail('USER32.DLL', 'BlockInput', @BlockInput) then
    begin
     ShowMessage('Your Mouse and Keyboard will be blocked for 5 seconds!') ;
     BlockInput(true) ;
     Sleep(5000) ;
     BlockInput(false) ;
    end;
   end;

 end.
Run Code Online (Sandbox Code Playgroud)

此代码是否也适用于WIN键等?

谢谢!

Mas*_*ler 8

你的想法太难了.

设置可由鼠标而不是键盘控制的信息亭的适当方法是不连接键盘. (这也使得不道德的自助服务终端用户无法窃取您的键盘.)

这也意味着,如果您需要执行管理任务,您可以附加键盘(或远程输入),一切都会正常工作.

  • 肯定会带走物理键盘,但也要确保用户无权运行Windows的屏幕键盘(osk.exe). (7认同)