Skip to content

TWinEventHook allows you to hook into certain Windows events.

License

Notifications You must be signed in to change notification settings

JensBorrisholt/TWinEventHook

Repository files navigation

TWinEventHook

TWinEventHook is a Delphi wrapper arrounf the Win32 function SetWinEventHook, which allows you to hook into certain Windows events.

The included Demo catches all Windows Events and logs the EventTime and the current Timestamp It's all shown in a ListView

Demo Application

Example of use:

uses
  WinEventHook;
  
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
    procedure HookProc(Hook: TWinEventHook; const HookMsg: TWinEventStruct);
  public
    { Public declarations }
  end;
  
procedure TForm1.FormCreate(Sender: TObject);
begin
  with THookContainer.Create(Self, EVENT_OBJECT_CREATE).Hook do
  begin
    OnExecute := HookProc;
    Active := True;
  end;

  with THookContainer.Create(Self, EVENT_OBJECT_DESTROY).Hook do
  begin
    OnExecute := HookProc;
    Active := True;
  end;
end;
 
 procedure TForm1.HookProc(Hook: TWinEventHook; const HookMsg: TWinEventStruct);
begin
  //Do Stuff with   HookMsg
end;

About

TWinEventHook allows you to hook into certain Windows events.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages