AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Alle Systemweiten Eingaben abfragen

Ein Thema von Destroyer446 · begonnen am 23. Jun 2012 · letzter Beitrag vom 25. Jun 2012
 
Destroyer446

Registriert seit: 17. Jan 2011
67 Beiträge
 
#2

AW: Alle Systemweiten Eingaben abfragen

  Alt 23. Jun 2012, 20:52
*Hab doch noch ein Problem, und zwar habe ich einen Code womit ich Keyboard-Eingaben
Handle-Weit abfragen kann.
Wie kann ich das jetzt Systemweit machen?
DLL:
Delphi-Quellcode:
library KeyboardHook;

uses
  Windows, Messages, SysUtils, Dialogs;

var
  HookHandle: Cardinal = 0;
  WindowHandle: Cardinal = 0;
  PressedKey: Integer = 0;
  LastKey: Integer = 0;

function KeyboardHookProc(nCode: Integer; wParam: WPARAM; lParam: LPARAM):
LRESULT; stdcall;
begin
//es ist ebenfalls möglich die Bearbeitung an eine Bedingung zu knüpfen
//it's possible to call CallNextHookEx conditional only.
  Result := CallNextHookEx(HookHandle, nCode, wParam, lParam);
  case nCode < 0 of
    TRUE: exit; //wenn code kleiner 0 wird nix gemacht
                //if code smaller 0 nothing has to be done
    FALSE:
      begin
        PressedKey := WPARAM;
        If LastKey = PressedKey then
        begin
          PressedKey := 0;
          LastKey := 0;
        end
        else
          LastKey := WPARAM;
//Hier kann jetzt alles bearbeitet werden
//Here one can work with the parameters
      end;
  end;
end;

function InstallHook(Hwnd: Cardinal): Boolean; stdcall;
begin
  Result := False;
  if HookHandle = 0 then begin
//Erstmal Hook installieren
//First install the hook
    HookHandle := SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookProc,
    HInstance, 0);
//Uebergebenes Fensterhandle sichern
//Save the given window handle
    WindowHandle := Hwnd;
    Result := TRUE;
  end;
end;

function UninstallHook: Boolean; stdcall;
begin
//Hook aus der Hookchain entfernen
//Uninstall hook from hook chain
  Result := UnhookWindowsHookEx(HookHandle);
  HookHandle := 0;
end;

procedure GetPressedKey(var Res: Integer); stdcall;
begin
  Res := PressedKey;
  PressedKey := 0;
end;

exports
//Installations- und Deinstallationsroutine exportieren
//Export the installation and deinstallation routine
  InstallHook,
  UninstallHook,
  GetPressedKey;
end.
Mfg
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:05 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz