Scenario 7. Keyboard Enhancement
This scenario makes use of filtering to create an enhancer application program. An enhancer application program is one that monitors the data coming in from the keyboard and changes it in some specified way. Typically, these application programs use instructions called keyboard macros, which tell them what keystrokes to look for and what changes to make. The change might involve suppressing a keystroke (so it appears to the target application as though it was never sent), replacing a keystroke with another, or replacing single keystroke with a series of keystrokes.
To do this using EHLLAPI, you might construct this scenario:
- Your EHLLAPI application program calls the Connect Presentation Space (1) function to connect to the presentation space whose keystrokes are to be filtered.
- Your EHLLAPI program next calls the Start Keystroke Intercept (50) function specifying the L option. This causes all keystrokes to be routed to the filtering application program.
- The filtering application program can now define a loop in which:
- The Get Key (51) function intercepts all keystrokes being sent to the target presentation space.
- The filtering application examines each keystroke and performs
a keyboard macro task, such as:
- Abbreviating program commands so that three- or four-keystroke command can be condensed into a single keystroke
- Customizing commands so that they are easier to remember or consistent with other software packages
- Creating boiler plates for contracts or frequently used letters
- Rearranging the keyboard for concurrent applications that use the same keys for differing functions
- If a keystroke is rejected, your EHLLAPI program can cause a beep to be sounded, using the Post Intercept Status (52) function.
- After your EHLLAPI program exits the filtering loop, Stop Keystroke Intercept (53) function to end the filtering process.