Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Getting selected text globally

Getting selected text globally

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Christian Skovdal Andersen
    wrote on last edited by
    #1

    Hi, I have noticed that some programs can get the contents of a selection, and do something with it one a global hotkey is pressed. Some of them are spell checkers that will spellcheck the selected word in almost any application, some of them are telephony applications that will try to dial the selected text as a telephone number. Does anybody know how to do this? I have tried to get numerous samples, including the PC Magazine Robotype, but this program only knows which text that has been written. Any help would be greatly appreciated! Thank you for reading this far ;-) Christian Skovdal Andersen

    T 1 Reply Last reply
    0
    • C Christian Skovdal Andersen

      Hi, I have noticed that some programs can get the contents of a selection, and do something with it one a global hotkey is pressed. Some of them are spell checkers that will spellcheck the selected word in almost any application, some of them are telephony applications that will try to dial the selected text as a telephone number. Does anybody know how to do this? I have tried to get numerous samples, including the PC Magazine Robotype, but this program only knows which text that has been written. Any help would be greatly appreciated! Thank you for reading this far ;-) Christian Skovdal Andersen

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      To get HWND, use GetForegroundWindow (not GetActiveWindow). Then, you can check if it's edit or richedit control, and if this is the case, grab the text with EM_GETSEL. Tomasz Sowinski -- http://www.shooltz.com

      What is "scratch" and why can everything be made from it?

      G 1 Reply Last reply
      0
      • T Tomasz Sowinski

        To get HWND, use GetForegroundWindow (not GetActiveWindow). Then, you can check if it's edit or richedit control, and if this is the case, grab the text with EM_GETSEL. Tomasz Sowinski -- http://www.shooltz.com

        What is "scratch" and why can everything be made from it?

        G Offline
        G Offline
        Gene Yu
        wrote on last edited by
        #3

        Glad to see your response. I have been looking for an answer to a similar question for a while! Can you tell me how to get to the selected text if the foreground window is not itself a edit control or richedit control but contains such controls? What about accessing a selected text in IE browser? Would appreciate very much your answers to these questions! Gene Yu - gene4yu@yahoo.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups