I need a way for a user to expand a code word typed in any Windows program into an associated string.?
For example, the user might type the word “address?? and with a click or two change it into their home address.
Suggestions are welcome, but the following method seems? promising:-
1.? Control is via a system tray program.? When opened this allows the user to specify a single code word? and a block of associated text. This block may be single- or multi-line.
The program has a context (right-click) menu. This gives the choices: “Enable/Disable?? and “Expand??.
2.? Assuming the program is Enabled, to expand the code word, the user must highlight it and then right-click on the control program icon.
? When the right-click menu is created (but before it is painted) the control program will issue a Control+C? character to send the highlighted text to the clipboard.
As all Windows programs support Control+C this should work with any application.
3.? The control program will then check the clipboard to see if it contains the code word.
If it does, the right-click menu will be painted and the option “Expand?? will be available (otherwise greyed-out). If Expand is chosen the characters of the associated text block will be injected into the current application.? This will replace the code word with the text as required.
5? It will be appreciated that the Control+C would overwrite any material placed on the clipboard by the user. It is therefore necessary to hook into the Windows low-level clipboard routines and intercept any text being sent to the clipboard.? This is likely to be the difficult part of the? project.