was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

41 Visitors Online


 
...Tastatur und Maus Ereignisse blockieren?
Autor: isilweo
[ Tip ausdrucken ]  

Tip Bewertung (14):  
     


// Import BlockInput function form user32.dll:
// BlockInput Funktion von user32.dll importieren:

function BlockInput(fBlockInput: Boolean): DWORD; stdcallexternal 'user32.DLL';

{block input/ blockieren}

procedure TForm1.Button1Click(Sender: TObject);
begin
  
BlockInput(True);
end;

{Unblock input / Blockierung aufheben}

procedure TForm1.Button2Click(Sender: TObject);
begin
  
BlockInput(False);
end;

{
Notes:
 Requires Windows 98/2000 or later.
 You can unblock input by pressing CTRL+ALT+DEL
 If you don't want the user to unblock
 by pressing CTRL+ALT+DEL, additionally write:
 SystemParametersInfo(97,Word(True),@OldValue,0);
 and to undo it:
 SystemParametersInfo(97,Word(False),@OldValue,0);
 (Var OldValue : Longbool)

 If you want to unblock your input after pressing button1
 the simple way to do it is use timer
 (just set it for few sec and tell it to unblock input
 after counting down)

Bemerkungen:
 Läuft nur unter Windows 98/2000 und
 späteren Versionen.
 Eine Blockierung kann mit CTRL+ALT+DEL aufgehoben werden.
 Um auch CTRL+ALT+DEL zu verhindern, kann zusätzlich noch
 SystemParametersInfo(97,Word(True),@OldValue,0);
 aufgerufen werden und mit
 SystemParametersInfo(97,Word(False),@OldValue,0);
 rückgängig gemacht werden.
 (Var OldValue : Longbool)

 Um eine Blockierung automatisch nach einer bestimmten
 Zeit wieder aufzuheben, kann ein Timer eingesetzt werden.
}

{***********************************************************}

{Function from

Babak Sateli
babak_sateli@yahoo.com
www.cdcenterco.com}

function FunctionDetect(LibName, FuncName: stringvar LibPointer: Pointer): Boolean;
var 
  
LibHandle: THandle;
begin
  
Result     := False;
  LibPointer := nil;
  if LoadLibrary(PChar(LibName)) = 0 then Exit;
  LibHandle := GetModuleHandle(PChar(LibName));
  if LibHandle <> 0 then
  begin
    
LibPointer := GetProcAddress(LibHandle, PChar(FuncName));
    if LibPointer <> nil then Result := True;
  end;
end;

// On Button Click Even

procedure TForm1.Button1Click(Sender: TObject);
var 
  
xBlockInput: function (Block: BOOL): BOOL; stdcall;
  begin
    if 
FunctionDetect('USER32.DLL', 'BlockInput', @xBlockInput) then
    begin
      
xBlockInput(True);  // Disable Keyboard & mouse
      
Sleep(10000);         // Wait for 10 Seconds
      
xBlockInput(False); // Enable  Keyboard & mouse
    
end;
  end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners