I want to copy the selected text in a window of another app, I think
there are at least two approaches to do it:
1. send a WM_COPY message to the target window. not tried yet but
somebody said that IE dose not response to this message.
2. send key combination ctrl+C to the target window, will this work with
all windows?
Any tips and comments are welcomed. Thanks.
Edwin -- MindVisualizer -- Productive Visual Mind Mapping Software
http://www.innovationgear.com
> 1. send a WM_COPY message to the target window.
> not tried yet but somebody said that IE dose not
> response to this message.
To copy text from an IE browser window, you have to extract the
IHTMLDocument2 interface from the window first:
How to get IHTMLDocument2 from a HWND
http://support.microsoft.com/kb/249232
With that, you can then access the selected text via the selection property:
IHTMLDocument2::selection Property
http://msdn2.microsoft.com/en-us/library/aa752606.aspx
Or you can use the execCommand() method to send a Copy command:
IHTMLDocument2::execCommand Method
http://msdn2.microsoft.com/en-us/library/aa752577.aspx
> 2. send key combination ctrl+C to the target window,
> will this work with all windows?
Not all, no.
Gambit
Thanks for your great information!