AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Globaler Maushook in DLL->Callback-Funktion in Programm?
Thema durchsuchen
Ansicht
Themen-Optionen

Globaler Maushook in DLL->Callback-Funktion in Programm?

Ein Thema von Hedge · begonnen am 16. Sep 2008 · letzter Beitrag vom 17. Sep 2008
Antwort Antwort
Hedge

Registriert seit: 30. Jun 2007
278 Beiträge
 
Delphi 2009 Professional
 
#1

Re: Globaler Maushook in DLL->Callback-Funktion in Progra

  Alt 17. Sep 2008, 08:39
Zitat von toms:
Probier's mal so:

Delphi-Quellcode:
   
if ((lParam shr 30) and 1) = 1 then // Taste erneut gedrückt

if ((lParam shr 31) and 1) = 1 then // Taste losgelassen

Grundlegend funktioniert diese Variante. Habe ich lParam getestet den ich in eine KBDLLHOOKSTRUCT gelesen habe.

//Key Up
if ((lParam.flags shr 7) and 1) = 1 then
ShowMessage('Taste wurde losgelassen');

ABER:
Die Definition des wParam sieht so aus:
Zitat:
wParam
[in] Specifies the identifier of the keyboard message. This parameter can be one of the following messages: WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, or WM_SYSKEYUP.
und die von WM_KEYDOWN so:

Zitat:
WM_KEYDOWN
WPARAM wParam
LPARAM lParam;

Jetzt bräuchte ich das 30. Bit des lParam von WM_KEYDOWN welches der wParam der Callback-Funktion ist.

Habe versucht das so hinzukriegen:

Delphi-Quellcode:
function KeyboardHookProc(nCode: Integer; wParam: PMSG; lParam: PKBDLLHOOKSTRUCT): 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(0, nCode, cardinal(wParam), Cardinal(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
        if ((wParam^.lparam shr 30) and 1) = 1 then
          ShowMessage('beim ersten Mal tuts noch weh');
      end;
  end;
end;
Bei der Abfrage If ((wParam^.lparam shr 30) and 1) = 1 then ... gibt es jedes Mal eine Zugriffsverletzung :/
  Mit Zitat antworten Zitat
Antwort Antwort


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 08:47 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 by Thomas Breitkreuz