Delphi/CB
● Greatis ● Security ● AppDatabase ● Utilities ● Android ● .NET ● just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
Mouse Hook
Homepage
Download
Order
Features
OnMouseHook event with raw WinAPI data
Standard VCL's mouse events for mouse move, up, down and wheel
Related components
Keyboard Hook
Hot Keys
WinEvent

Other Delphi components
.Net components

Follow us
LinkedIn Twitter Facebook
Share this page
Free Delphi Software
Omid Motahed's Free Delphi Software
Special offer!

Mouse Hook

System-Wide Mouse Events Tracking Component for VCL

For all versions of Delphi and C++ Builder from 3 to 10.1 Berlin and for all versions of Windows from XP to 10


Mouse Hook component is a system-wide mouse event tracker that works without external DLL.

TMouseHook Interface

protected

procedure MouseHookProc(Message: Word; Point: TPoint; MouseData,Flags,Time: Integer; ExtraInfo: Pointer); virtual;
Hook calls this virtual procedure for each mouse event, you can override it to implement your own mouse event handlers in derived class.

public

constructor Create(AOwner: TComponent); override;
Overridden constructor creates object and initializes internal data.

destructor Destroy; override;
Overridden destructor frees internal data and destroys the object.

procedure Start;
Starts hook. You can also activate hook with Active property.

procedure Stop;
Stops hook. You can also deactivate hook with Active property.

property Active: Boolean;
Hook activity state.

published

property OnMouseHook: TMouseHookEvent;
This event occurs for each mouse event and distributes low-level data for mouse event. TMouseHooEvent is declared as

TMouseHookEvent = procedure(
  Sender: TObject;
  Message: Word;
  Point: TPoint;
  MouseData, Flags, Time: DWord;
  ExtraInfo: Pointer) of object;
The event parameters contains mouse message identifier and members of WinAPI's MSLLHOOKSTRUCT structure.

property OnMouseMove: TMouseMoveEvent;
Occurs when user move mouse over desktop or over any window in the system.

property OnMouseDown: TMouseEvent;
Occurs when user presses mouse button with the mouse pointer over desktop or over any window in the system.

property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp;
Occurs when user releases mouse button with the mouse pointer over desktop or over any window in the system.

property OnMouseWheel: TMouseWheelHookEvent read FOnMouseWheel write FOnMouseWheel;
Occurs when user rotates mouse wheel.

property OnMouseHWheel: TMouseWheelHookEvent read FOnMouseHWheel write FOnMouseHWheel;
Occurs when user rotates horizontal mouse wheel.

X and Y in all these events contains screen coordinates of mouse pointer. All the VCL-style events contains ShiftState parameter that contains states of Ctrl, Shift and Alt keys.

Mouse Hook component suite includes demo project that demonstrates main features of TMouseHook component:

Mouse Hook Demo


Download free demo, order full source code right now!


Greatis Software
eXTReMe Tracker