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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Get Text for a Control

Get Text for a Control

Scheduled Pinned Locked Moved C / C++ / MFC
help
7 Posts 4 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
    cats8199
    wrote on last edited by
    #1

    I am trying to get the text from a control in another process. I know the handle for the control and I know the afx class name. It is as follows: Class Name : Afx:400000:20 This control is part of a chatbox in an external application. I have tried several different things but I have so far failed to get the text from it. Any ideas or help would be greatly appreciated. Thanks. Dave

    D A PJ ArendsP 3 Replies Last reply
    0
    • C cats8199

      I am trying to get the text from a control in another process. I know the handle for the control and I know the afx class name. It is as follows: Class Name : Afx:400000:20 This control is part of a chatbox in an external application. I have tried several different things but I have so far failed to get the text from it. Any ideas or help would be greatly appreciated. Thanks. Dave

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

      cats8199 wrote: I have tried several different things... Such as?


      "One must learn from the bite of the fire to leave it alone." - Native American Proverb

      C 1 Reply Last reply
      0
      • C cats8199

        I am trying to get the text from a control in another process. I know the handle for the control and I know the afx class name. It is as follows: Class Name : Afx:400000:20 This control is part of a chatbox in an external application. I have tried several different things but I have so far failed to get the text from it. Any ideas or help would be greatly appreciated. Thanks. Dave

        A Offline
        A Offline
        Andy Moore
        wrote on last edited by
        #3

        Send the WM_GETTEXT message to that control. Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons

        C 1 Reply Last reply
        0
        • D David Crow

          cats8199 wrote: I have tried several different things... Such as?


          "One must learn from the bite of the fire to leave it alone." - Native American Proverb

          C Offline
          C Offline
          cats8199
          wrote on last edited by
          #4

          I have tried sending the messages EM_GETLINECOUNT and WM_GETTEXT. Both return zero. This is a multiline text box. I have tried treating it as a CListBox, a CComboBox and a CListCtrl. All to no avail. Dave

          D 1 Reply Last reply
          0
          • A Andy Moore

            Send the WM_GETTEXT message to that control. Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons

            C Offline
            C Offline
            cats8199
            wrote on last edited by
            #5

            I have tried sending the messages EM_GETLINECOUNT and WM_GETTEXT. Both return zero. This is a multiline text box. I have tried treating it as a CListBox, a CComboBox and a CListCtrl. All to no avail. Dave

            1 Reply Last reply
            0
            • C cats8199

              I have tried sending the messages EM_GETLINECOUNT and WM_GETTEXT. Both return zero. This is a multiline text box. I have tried treating it as a CListBox, a CComboBox and a CListCtrl. All to no avail. Dave

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

              cats8199 wrote: This is a multiline text box. I have tried treating it as a CListBox, a CComboBox and a CListCtrl. All to no avail. It's no surprise! Why haven't you tried CEdit instead? That, however, is not the problem here. If neither EM_GETLINECOUNT nor WM_GETTEXT worked, using an MFC class is just added complexity.


              "One must learn from the bite of the fire to leave it alone." - Native American Proverb

              1 Reply Last reply
              0
              • C cats8199

                I am trying to get the text from a control in another process. I know the handle for the control and I know the afx class name. It is as follows: Class Name : Afx:400000:20 This control is part of a chatbox in an external application. I have tried several different things but I have so far failed to get the text from it. Any ideas or help would be greatly appreciated. Thanks. Dave

                PJ ArendsP Offline
                PJ ArendsP Offline
                PJ Arends
                wrote on last edited by
                #7

                Check out this article, it has code that does what you want.http://www.codeproject.com/tools/WindowScraper_Utility.asp[^] If you tried sending a WM_SETTEXT message to the window and it doesn't work, it could because the authors of the control did not implement a WM_SETTEXT handler. I see this error quite often in custom controls. What a lot of people seem to do is override the GetWindowText() function, instead of adding a WM_GETTEXT message handler.


                "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

                Within you lies the power for good; Use it!

                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