Search results for 'Disable Mouse'. 2 post(s) found.
- 2007/09/25 How to restrict mouse movement
- 2007/09/19 Disable Mouse and Keyboard from Delphi Code
Here's how to restrict the mouse movement to a form and release this restriction after a click on a form:
procedure TForm1.FormCreate(Sender: TObject) ;
var r : TRect;
begin
//it would be good idea to move the
//mouse inside the form before restriction
r := BoundsRect;
ClipCursor(@R) ;
end;
procedure TForm1.FormClick(Sender: TObject) ;
begin
//always be sure to release the cursor
ClipCursor(nil) ;
end;
var r : TRect;
begin
//it would be good idea to move the
//mouse inside the form before restriction
r := BoundsRect;
ClipCursor(@R) ;
end;
procedure TForm1.FormClick(Sender: TObject) ;
begin
//always be sure to release the cursor
ClipCursor(nil) ;
end;
Another posts included in "Delphi"
| How to send char as message to another application (0) | 2007/09/25 |
| How to save text from Clipboard to a file (0) | 2007/09/25 |
| How to show window contents while dragging (0) | 2007/09/25 |
| List Devices (LPT, COM ports, ...) (0) | 2007/09/25 |
| How to know whether the font is TrueTypeFont or not (0) | 2007/09/25 |
| How to track a user's idle time (0) | 2007/09/25 |
| How to remove your application from TaskBar (0) | 2007/09/25 |
| How to play sounds on the PC Speaker ? (0) | 2007/09/20 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/28 22:28
moneyideas
-
Subject different money making ideas
2010/01/29 06:39
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas
The BlockInput API function blocks keyboard and mouse input events from reaching applications.
Place a Button (name: "Button1") on a form (name: "Form1") and use this code for the button's OnClick event handler. Once you click the button your mouse and keyboard will be blocked for 5 seconds.
Note: BlockInput is available only on Windows 98 and newer,
this is why we have a "FuncAvaial" procedure - to test the existance of
a function inside a DLL.
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.
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.
Another posts included in "Delphi"
| Display Standard Windows Properties dialog (0) | 2007/09/19 |
| Disable ALT+TAB, CTRL+ESC, CTRL+ALT+DEL (0) | 2007/09/19 |
| Get Windows Temp directory (0) | 2007/09/20 |
| Detecting Drive Types (0) | 2007/09/19 |
| Detecting and preventing Windows shut down (0) | 2007/09/19 |
| Create new program group in the Start menu (0) | 2007/09/19 |
| Copying Group of Files using Delphi with Standard Animation Dialog (SHF... (0) | 2007/09/19 |
| Controling sound volume from code (0) | 2007/09/19 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 02:08
moneyideas
-
Subject different money making ideas
2010/01/29 10:30
moneyideas
-
Subject different money making ideas
2010/01/31 16:40
moneyideas

Prev

Rss Feed