Keyboard HookSystem-Wide Keyboard 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
Keyboard Hook component is a system-wide keyboard events tracker that works without external DLL.
procedure KeyboardHookProc(VirtualKeyCode,ScanCode,Flags,Time: Integer; ExtraInfo: Pointer); virtual;
Hook calls this virtual procedure for each keyboard event, you can override it to implement your own keyboard events 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 OnKeyboardHook: TKeyboardHookEvent;
This event occurs for each keyboard event and distributes low-level data for keyboard event. TKeyboardHookEvent is declared as
The event parameters contains keyboard message identifier and members of WinAPI's KBDLLHOOKSTRUCT structure.
ExtraInfo: Pointer) of object;
property OnKeyDown: TKeyEvent;
Occurs when user presses key.
property OnKeyUp: TKeyEvent;
Occurs when user releases key.
property OnChars: TCharsEvent;
Occurs when user presses character key. TCharsEvent is declared as
TCharsEvent = procedure(Sender: TObject; Chars: string) of object;
When user enter dead-key character (accent or diacritic) the output can be more than 1 character.
Keyboard Hook component suite includes demo project that demonstrates main features of TKeyboardHook component: