There is no one unified mechanism in Windows for handling text selection.
When issuing a double-click to a program, it receives that event and handles it using
its own logic and code. Therefore you will get different behaviors from different
programs. The results will be, for example, different in Notepad, Wordpad, Word etc.
Even within Office, there will be differences on behavior and options
between Word and Excel etc.
You will need to build a mechanism that intercepts double-click and does its own
trick. A good tool would be
AutoHotkey
with which you could write a script that converts the double-click into a series
of operations on the active program.
You will need to make certain assumptions on the user-interface, which might
not apply to all programs, and you will need a mechanism for extracting data
from the programs - for me the only universal one is the clipboard.
This will conflict with any product that manages clipboard history,
since you will be filling up its history list with partial data.
You will need to assume that the target program follows
the usual conventions for moving the cursor and selecting characters.
The AutoHotkey script that you will write will do:
- Intercept the double-click while remembering the target window and the
X-Y coordinates of the click
- Send a simple click to theses coordinates
- Send Shift+Home to select all characters to the left
- Send Ctrl+C to copy the characters and
find out the number of characters L to select on the left
- Send another simple click to theses coordinates
- Send Shift+End to select all characters to the right
- Send Ctrl+C to copy the characters and
find out the number of characters R to select on the right
- Send again a simple click to theses coordinates
- Send L times a Left arrow
- Send L+R times Shift+Right to do the selection
- Done.
Remember to add a few milliseconds wait after issuing keys, to allow
the target program the time to process them.