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:
  1. Your EHLLAPI application program calls the Connect Presentation Space (1) function to connect to the presentation space whose keystrokes are to be filtered.
  2. 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.
  3. The filtering application program can now define a loop in which:
    1. The Get Key (51) function intercepts all keystrokes being sent to the target presentation space.
    2. 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
      For example, the filtering application might convert a key combination such as Alt+Y into a command to move the cursor to column 35 of the second line in presentation space and write the string “XYZ Tool Corporation, Dallas, Texas”.
    3. If a keystroke is rejected, your EHLLAPI program can cause a beep to be sounded, using the Post Intercept Status (52) function.
  4. After your EHLLAPI program exits the filtering loop, Stop Keystroke Intercept (53) function to end the filtering process.