Example Delphi
Delphi Examples Collection
Today, Delphi is one of the popular desktop programming tool. There are thousand even million programmer in this world using delphi as their favorit tool. This site try to collect the examples, tips and tricks of Delphi programming. We collect, test them and redistribute the collection of delphi programming for you.
Kill the Mouse and Keyboard
Author: admin | Category: System, Tips and Tricks, Windows API
//We can unse this script to kill the mouse and keyboard function //Anyway this program can't stop the Ctrl+Alt+Del Function unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function FunctionDetect(LibName, FuncName: string; var 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; procedure TForm1.Button1Click(Sender: TObject); var xBlockInput: function (Block: BOOL): BOOL; stdcall; OldValue : LongBool; begin if FunctionDetect('USER32.DLL', 'BlockInput', @xBlockInput) then begin xBlockInput(True); // Disable Keyboard & mouse //SystemParametersInfo(97,Word(True),@OldValue,0); Sleep(10000); // Wait for 10 Seconds xBlockInput(False); // Enable Keyboard & mouse end; end; end.
Post Meta
-
System, Tips and Tricks, Windows API -
Comments Feed -