Results 1 to 3 of 3

Thread: Webbrowser control - Detecting Selected Text event

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56

    Webbrowser control - Detecting Selected Text event

    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?

  2. #2
    chenko
    Guest
    Not possible

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2001
    Location
    Toronto, Ontario, Canada
    Posts
    56

    Soultion found

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width