22 Mart 2012 Perşembe

Kill the Mouse and Keyboard (Klavye ve Mouse engelleme)


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;

Hiç yorum yok:

Yorum Gönder