Getting user-selected text from any app

Discussion in 'Win32' started by Eidetikos, May 29, 2010.

  1. Eidetikos

    Eidetikos Banned

    Joined:
    May 28, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    I've been struggling for a while now with retrieving the highlighted/selected text from any window. I've used:

    GetForegroundWindow
    GetCursorPos
    WindowFromPoint
    SendMessage(... GETTEXT...)/SendMessage(...GETSELTEXT...)

    It only really seems to work for Notepad. I can't get it to work with Word, IE, Firefox, etc.
     
  2. pankaj.sea

    pankaj.sea New Member

    Joined:
    Apr 6, 2009
    Messages:
    461
    Likes Received:
    13
    Trophy Points:
    0
    Occupation:
    Web Developer
    Location:
    Kolkata
    Home Page:
    http://ipankaj.net
    will you please explain your full job?
     
  3. Eidetikos

    Eidetikos Banned

    Joined:
    May 28, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Sure. I'm making a dictionary desktop utility so that whenever someone highlights text in any program and then presses the hotkeys, the selected text is captured by the utility and then processed.


    You may have seen them before with Babylon, Oxford's Russian Dictionary and I'm sure countless others.


    The workaround I'm using now is by emulating Ctrl-C but copying to the clipboard is a poor solution.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice