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. copying text from the webpages or pdfs which are selected by mouse

copying text from the webpages or pdfs which are selected by mouse

Scheduled Pinned Locked Moved C / C++ / MFC
c++
7 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.
  • A Offline
    A Offline
    aravind sn
    wrote on last edited by
    #1

    im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.

    _ R I P 4 Replies Last reply
    0
    • A aravind sn

      im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      you need Mouse and Keyboard Hooks[^] See SetWindowsHook etc. Correction!

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      modified on Thursday, April 16, 2009 7:43 AM

      R 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        you need Mouse and Keyboard Hooks[^] See SetWindowsHook etc. Correction!

        You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

        modified on Thursday, April 16, 2009 7:43 AM

        R Offline
        R Offline
        Rajesh R Subramanian
        wrote on last edited by
        #3

        Mouse and keyboard hooks will be of absolutely no use in retrieving text. (A keyboard hook might be of benefit, to trap the hotkeys however.)

        It is a crappy thing, but it's life -^ Carlo Pallini

        _ 1 Reply Last reply
        0
        • A aravind sn

          im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          Have a look at this article: How to retrieve text under the mouse cursor[^]

          It is a crappy thing, but it's life -^ Carlo Pallini

          1 Reply Last reply
          0
          • A aravind sn

            im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.

            I Offline
            I Offline
            Iain Clarke Warrior Programmer
            wrote on last edited by
            #5

            This is not an easy challenge. 1/ Detect the key being pressed! Keyboard hook, or a global hot key (see RegisterHotKey) which I'd recommend more. 2/ Then you have to get the window user the mouse. (RealChildWindowFromPoint) 3/ Then you have to extract the actual text. The way of doing this will vary from application to application. Firefox will be different from iexplore. FoxitReader will be different from Acrobat. 4/ You could get the pixel in the window, maybe using WM_PRINT, but then you'd have to OCR them to get the text... 5/ pdf and html viewers already have clipboard filling functions... It's a lot less work to use them! Good luck though, as this would be a major challenge to a pro. Maybe a semi-newbie who isn't afraid is the best person! Iain.

            In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[^]

            1 Reply Last reply
            0
            • R Rajesh R Subramanian

              Mouse and keyboard hooks will be of absolutely no use in retrieving text. (A keyboard hook might be of benefit, to trap the hotkeys however.)

              It is a crappy thing, but it's life -^ Carlo Pallini

              _ Offline
              _ Offline
              _AnsHUMAN_
              wrote on last edited by
              #6

              umm! thanks for correcting. I will go through the link you provided.

              You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

              1 Reply Last reply
              0
              • A aravind sn

                im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.

                P Offline
                P Offline
                ParagPatel
                wrote on last edited by
                #7

                I am not 100% sure, but you can go in below way. 1) Register your hotkey (RegisterHotKey). 2) When hotkey pressed. a. get focused or current window handle using "WindowFromPoint" API b. send below message to window using handle to get text. WM_GETTEXT or EM_GETSELTEXT or EM_GETSEL

                Parag Patel Sr. Software Eng, Varaha Systems

                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