HotKeyManager, ver. 1.0.0

[Properties] [Methods] [Events] [Static methods]
[Known Bugs] [Hints] [Comments]

HotKeyManager is a component that allows you to add system hotkeys to your application.

A hotkey in Windows is a key combination which invokes a specific action. You can often use Ctrl+S from an application to save a file. However, a system hotkey allows your app. to invoke a custom action from anywhere. Your app. doesn't have to be in the foreground or even visible. The best known example of a system hotkey is probably Ctrl+Alt+Delete which pops up a system dialog.

Properties

Methods

AddHotKey function AddHotKey(HotKey: TShortCut): Word;
Registers a hotkey with a specific key combination.
NOTE: A return value of 0 means the specified key combination is already in use.
Returns an index or 0 if error
ChangeHotKey function ChangeHotKey(Index: Word; NewHotKey: TShortCut): Word;
Changes a hotkey to a new key combination. Provide the index received from AddHotKey as parameter.
NOTE: This method returns a new index. The old index is no longer valid.
Returns an index or 0 if error
RemoveHotKey function RemoveHotKey(HotKey: TShortCut): Boolean;
Unregisters a hotkey by its key combination.
Returns true or false
RemoveHotKeyByIndex function RemoveHotKeyByIndex(Index: Word): Boolean;
Unregisters a hotkey by the index received from AddHotKey.
Returns true or false
ClearHotKeys procedure ClearHotKeys;
Unregisters all registered hotkeys.

Events

OnHotKeyPressed type TOnHotKeyPressed = procedure(HotKey: TShortCut; Index: Word) of object;
Fired when then user presses one of the registered hotkeys. The event method provides the key combination pressed and the index the hotkey is registered under.

Static Methods

HotKeyAvailable function HotKeyAvailable(HotKey: TShortCut): Boolean;
Tests if the specified key combination is available for registration by your app. (or any other app.).
Returns true or false
SeparateHotKey procedure SeparateHotKey(HotKey: Word; var Modifiers, Key: Word);
Splits a key combination into a key (A, for instance) and its modifiers (shift, ctrl, alt, win).

Hints

Known Bugs

Comments

HotKeyManager is freeware. Feel free to use and improve it, but please include all original files if you redistribute the zip-file. If you have any comments or corrections I would very much like to hear them.

Get the latest version from http://www3.ewebcity.com/troels/delphi.asp.

Troels Jakobsen
delphiuser@get2net.dk