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. How to get text on screen

How to get text on screen

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
6 Posts 5 Posters 0 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.
  • L Offline
    L Offline
    levgiang
    wrote on last edited by
    #1

    How to get text on screen at current mouse position. le van giang

    J A D 3 Replies Last reply
    0
    • L levgiang

      How to get text on screen at current mouse position. le van giang

      J Offline
      J Offline
      jan larsen
      wrote on last edited by
      #2

      I can see that you're cross posting, so what language are you interested in? Furthermore, your question is a bit fluffy, I think you have to be a bit more specific. As leppie says in the C# forum, it's not possible to just get the text at a certain point. But you can get the text from the HWND at the current corsor position, look up these functions in the Win32 API: WindowFromPoint, SetWindowsHookEx, GetWindowText, ChildWindowFromPoint. "After all it's just text at the end of the day. - Colin Davies "For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus

      1 Reply Last reply
      0
      • L levgiang

        How to get text on screen at current mouse position. le van giang

        A Offline
        A Offline
        Anand for every one
        wrote on last edited by
        #3

        do you want the text to appear within your application window or anywhere in screen(including the area out of your application window). 1) if you want the text to appear within your application window, handle WM_LBUTTONDOWN OR onLButtonDown(in mfc), and within that get the device context of client(GetClientDC(this)) and display the text using TextOut or DrawText.(use point for mouse location) 2) if you want the text to appear anywhere in screen, -Capture the mouse using SetCapture. -Get the screen device context, using CreateDC(NULL). -display the text using TextOut or DrawText.(use point for mouse location) :cool:

        1 Reply Last reply
        0
        • L levgiang

          How to get text on screen at current mouse position. le van giang

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          The word "get" is ambiguous here. Do you want to read text from the screen, or write text to the screen?


          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          A 1 Reply Last reply
          0
          • D David Crow

            The word "get" is ambiguous here. Do you want to read text from the screen, or write text to the screen?


            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            A Offline
            A Offline
            Anonymous
            wrote on last edited by
            #5

            I want to read text from anywhere on screen.

            D 1 Reply Last reply
            0
            • A Anonymous

              I want to read text from anywhere on screen.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              That will require use of the IAccessible interface, specifically the get_accValue() method.


              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              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