Click to See Complete Forum and Search --> : Webbrowser control - Detecting Selected Text event
Bishop
Jul 7th, 2001, 04:40 PM
Does anyone know how to detect when inside the webbrowser control that a user has selected text?
The only way I know how to (force the system to press Ctrl+C and check the contents of clipboard) does not work in my program correctly since other events occur at the same time that hinder its correct operation.
Suggestions?
chenko
Jul 7th, 2001, 05:02 PM
Not possible :(
Bishop
Jul 7th, 2001, 05:16 PM
After struggling for an afternoon... I found out a very close simulation....
Instead of forcing Ctrl+C into the system (using the USER32 keybd_event command), use a combination of two things:
MFC Copy command:
WebBrowser.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
Clipboard Type Detection:
And because we are looking for a text, not binary data, use Clipboard.GetText to detect the type of Clipboard data afterward...
Then use the same strategy: check the clipboard to see if it is non-null.. if it's null... no text has been selected... if it is non-null, text is selected.
Close as I can get.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.