Mouse HookSystem-Wide Mouse Events Tracking Component for VCL
For all versions of Delphi and C++ Builder from 3 to 10.2 Tokyo 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.
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.
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.
Starts hook. You can also activate hook with Active property.
Stops hook. You can also deactivate hook with Active property.
property Active: Boolean;
Hook activity state.
property OnMouseHook: TMouseHookEvent;
This event occurs for each mouse event and distributes low-level data for mouse event. TMouseHooEvent is declared as
The event parameters contains mouse message identifier and members of WinAPI's MSLLHOOKSTRUCT structure.
TMouseHookEvent = procedure(
MouseData, Flags, Time: DWord;
ExtraInfo: Pointer) of object;
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.