Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Keyboard under W2K

Status
Not open for further replies.

December

Programmer
Nov 29, 2002
19
0
0
UA
Greetings all!
How can one disable keyboard under W2K?
 
Can you capture the keypress events on the form (keypreview = true)

and on_keypress just do an exit, or reset the ORD to be zero?

Doesnt "really" disable the keyboard but in a form based application you can emulate this.

"If it's stupid and it works, then it isn't stupid"
 
Button1 on Form1 - disable mouse and keyboard for 5 seconds:
~~~~~~~~~~~~~~~~~~~~~~~~~
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
xBlockInput : function(Block: BOOL):
BOOL; stdcall;

begin
if FuncAvail
('USER32.DLL', 'BlockInput', @xBlockInput) then
begin
xBlockInput(true) ;
Sleep(5000) ;
xBlockInput(false) ;
end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top