OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The THotKey class encapsulates the hot-key control from the Common Control Library.
A hot key is a key combination that the user can press to perform an action quickly. The key combination can consist of a modifier key, such as CTRL, ALT or SHIFT, and an accompanying key, such as a character key, an arrow key or a function key.
THotKey has two constructors: one for creating a new hot key object and one for aliasing a hot-key control which was defined in a dialog resource.
To create a new control, use the THotKey(TWindow* parent, int id, int x, int y, int w, int h, TModule* module = 0) constructor.
The following code fragement shows how to create a new hot-key control within a window represented by the class TMyWindow.
To alias a hot-key control from a dialog resource, use the THotKey(TWindow* parent, int resourceId, TModule* module = 0) constructor.
The following code fragment illustrates this:
The SetHotKey and GetHotKey methods of THotKey allow you to set and retrieve the virtual key code and modifier flags of a hot-key from a hot-key control.
The value returned from the GetHotKey method can be used with the WM_SETHOTKEY message to associate a window with a hot-key. When user presses the hot-key, the system activates the window.
The value retrieved from the hot-key control is not usable with the RegisterHotKey API.
You can customize a hot-key control by specifying invalid key combinations and providing the default modifier. See the SetRules method for more information.