AGB  ·  Datenschutz  ·  Impressum  







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

Bei Maus klich Timer stoppen

Ein Thema von citybreaker · begonnen am 12. Feb 2005 · letzter Beitrag vom 13. Feb 2005
Antwort Antwort
citybreaker
(Gast)

n/a Beiträge
 
#1

Re: Bei Maus klich Timer stoppen

  Alt 13. Feb 2005, 17:16
So, jetzt habe ich mir mal nen kleinen hook gebaut, kriege auch alles
ohne Fehler gestartet, nur passiert nix.

mousehook.dll
Delphi-Quellcode:
library mousehook;

uses
  SysUtils,
  Classes,
  Windows,
  Messages,
  Dialogs;

var
  HookHandle: Cardinal = 0;
  WindowHandle: Cardinal = 0;

{$R *.res}

function MouseHookProc(nCode:integer;wParam:WParam;lParam:LParam): LResult; stdcall;
begin
  Result := CallNextHookEx(HookHandle,nCode,wParam,lParam);

  case nCode < 0 of
    true: exit;
    false: begin
     if GetAsynckeyState(vk_lbutton) <> 0 then
       showmessage('Die linke taste wurde gedrückt');
    end;
  end;
end;

function InstallHook(Hwnd: Cardinal): Boolean; stdcall;
begin
  result := false;
  if HookHandle = 0 then begin
    HookHandle := SetWindowsHookEx(WH_Mouse,@MouseHookProc,
                                   hInstance, 0);
    WindowHandle := hwnd;
    Result := true;
  end;
end;

function UninstallHook: Boolean; stdcall;
begin
  Result := UnHookWindowsHookEx(HookHandle);
  HookHandle := 0;
end;

exports
  InstallHook,
  UninstallHook;
end.
MainFrm.pas
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
  lib := loadlibrary('keyhook.dll');
  if lib <> Invalid_Handle_Value then begin
    InstallHook := GetProcAddress(lib,'InstallHook');
    UninstallHook := GetProcAddress(lib,'UninstallHook');
  end else Close;
end;
  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 10:16 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