«« Site Rescued »»

While the site is still going to move from its current host, a new site will now take its place. More Info.

The new site may have less content, but the core will now remain. And it will now play nicely with phones! Keep an eye on the DelphiDabbler Blog for news.

» Help

How to block input to the system until released

   

The Windows API BlockInput function prevents all input to the system, making it appear locked up until released. Declare the function as:

function BlockInput(fBlockInput: Boolean): DWORD; stdcall;
  external 'user32.dll';

Usage: Set to True to "lock-up" and False to "unlock" input devices.

The following code locks up input for 2 seconds:

procedure TForm1.Button1Click(Sender: TObject);
begin
  BlockInput(True);
  Label1.Caption := 'Blocked';
  Application.ProcessMessages;
  Sleep(2000);
  BlockInput(False);
  Label1.Caption := 'Unblocked';
end;

Example code added by Peter Johnson

Author: DennisLV
Added: 2007-06-11
Last updated: 2007-06-11

« Return to contents »