haab
asked on
How to grab selected text in a window
Is it possible to get selected text from a window without sending it to the clipboard using the keystrokes Ctrl + C?
What I do at the moment, is that I react on the mouse event WM_LBUTTONUP in windows/controls with classnames that I list in my Delphi program. At the moment of the Mouse Up Event, I also know the handle of that window/control. I send Ctrl + C to that window, but my question is: Is there another way, can the selected text be acquired with for instance the Windows messaging methods, or by other means, not including the clipboard?
What I do at the moment, is that I react on the mouse event WM_LBUTTONUP in windows/controls with classnames that I list in my Delphi program. At the moment of the Mouse Up Event, I also know the handle of that window/control. I send Ctrl + C to that window, but my question is: Is there another way, can the selected text be acquired with for instance the Windows messaging methods, or by other means, not including the clipboard?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well, it is only the selected text that I want. I already know how to get the entire text of controls; the problem is to grab only the selected text, and the question whether it is possible to do so without involving the clipboard.
Thank you for your kind response, both on this issue and my other question from today regarding the maintaining of clipboard formats!
Thank you for your kind response, both on this issue and my other question from today regarding the maintaining of clipboard formats!
ASKER
I see that you have given some code as well. Thank you! I will try it out!
Again, test for the type of focused control, then use the
SelText property of the control
MyText:= TEdit(Form1.ActiveControl) .SelText;
Shane
SelText property of the control
MyText:= TEdit(Form1.ActiveControl)
Shane
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Shane