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. Problem getting Caption of a window control using SendMessage & WM_GETTEXT

Problem getting Caption of a window control using SendMessage & WM_GETTEXT

Scheduled Pinned Locked Moved C / C++ / MFC
help
14 Posts 6 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.
  • P Offline
    P Offline
    PankajB
    wrote on last edited by
    #1

    Hi There. I am trying to get a caption of a windows control using below code... But its fatching only a set of square boxes (Carriage return).

    TCHAR buf[512];
    ::SendMessage(pWaitingProcessCompleteWnd6, WM_GETTEXT, 0 , (LPARAM)buf);

    I have checked the address of pWaitingProcessCompleteWnd6 using spy++, its pointing to the right control. Please help. Thanks PanB

    D R 2 Replies Last reply
    0
    • P PankajB

      Hi There. I am trying to get a caption of a windows control using below code... But its fatching only a set of square boxes (Carriage return).

      TCHAR buf[512];
      ::SendMessage(pWaitingProcessCompleteWnd6, WM_GETTEXT, 0 , (LPARAM)buf);

      I have checked the address of pWaitingProcessCompleteWnd6 using spy++, its pointing to the right control. Please help. Thanks PanB

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

      PankajB wrote:

      But its fatching only a set of square boxes (Carriage return).

      How are you verifying this?

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      1 Reply Last reply
      0
      • P PankajB

        Hi There. I am trying to get a caption of a windows control using below code... But its fatching only a set of square boxes (Carriage return).

        TCHAR buf[512];
        ::SendMessage(pWaitingProcessCompleteWnd6, WM_GETTEXT, 0 , (LPARAM)buf);

        I have checked the address of pWaitingProcessCompleteWnd6 using spy++, its pointing to the right control. Please help. Thanks PanB

        R Offline
        R Offline
        Roger Stoltz
        wrote on last edited by
        #3

        How about using GetWindowText[^] instead?

        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
        "High speed never compensates for wrong direction!" - unknown

        R 1 Reply Last reply
        0
        • R Roger Stoltz

          How about using GetWindowText[^] instead?

          "It's supposed to be hard, otherwise anybody could do it!" - selfquote
          "High speed never compensates for wrong direction!" - unknown

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

          From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process, which makes GetWindowText() unusable. Of course, I'm only assuming things. :)

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

          R C 2 Replies Last reply
          0
          • R Rajesh R Subramanian

            From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process, which makes GetWindowText() unusable. Of course, I'm only assuming things. :)

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

            R Offline
            R Offline
            Roger Stoltz
            wrote on last edited by
            #5

            Rajesh R Subramanian wrote:

            From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process

            Ahh, I missed that one. You're probably right Rajesh.

            Rajesh R Subramanian wrote:

            Of course, I'm only assuming things.

            Yeah, that's usually 50% of the job trying to put together a useful answer depending on the lack of information in the posts.... ;)

            "It's supposed to be hard, otherwise anybody could do it!" - selfquote
            "High speed never compensates for wrong direction!" - unknown

            R 1 Reply Last reply
            0
            • R Roger Stoltz

              Rajesh R Subramanian wrote:

              From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process

              Ahh, I missed that one. You're probably right Rajesh.

              Rajesh R Subramanian wrote:

              Of course, I'm only assuming things.

              Yeah, that's usually 50% of the job trying to put together a useful answer depending on the lack of information in the posts.... ;)

              "It's supposed to be hard, otherwise anybody could do it!" - selfquote
              "High speed never compensates for wrong direction!" - unknown

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

              Roger Stoltz wrote:

              Yeah, that's usually 50% of the job trying to put together a useful answer depending on the lack of information in the posts.... Wink

              [Sylverster Stallone tone] Well, it's tough answering questions here. They give me a war that I cannot believe in. [/Sylverster Stallone tone]

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

              C 1 Reply Last reply
              0
              • R Rajesh R Subramanian

                Roger Stoltz wrote:

                Yeah, that's usually 50% of the job trying to put together a useful answer depending on the lack of information in the posts.... Wink

                [Sylverster Stallone tone] Well, it's tough answering questions here. They give me a war that I cannot believe in. [/Sylverster Stallone tone]

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

                C Offline
                C Offline
                CPallini
                wrote on last edited by
                #7

                Rajesh R Subramanian wrote:

                Sylverster Stallone tone

                Hey man, you're too young to remember Sly. --Carlo Rocky Rambo. :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                R 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  From his previous bizarre post (where he's searching for a control by it's caption), I think this particular control is owned by a different process, which makes GetWindowText() unusable. Of course, I'm only assuming things. :)

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

                  C Offline
                  C Offline
                  Code o mat
                  wrote on last edited by
                  #8

                  Actually, you can use GetWindowText on windows which belong to a different process.

                  > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                  R R 2 Replies Last reply
                  0
                  • C Code o mat

                    Actually, you can use GetWindowText on windows which belong to a different process.

                    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                    R Offline
                    R Offline
                    Roger Stoltz
                    wrote on last edited by
                    #9

                    Code-o-mat wrote:

                    Actually, you can use GetWindowText on windows which belong to a different process

                    Well, read the subject line of the post again and you'll find it mentions "window control". Then have a look at the documentation I linked to in my post where it clearly says "GetWindowText cannot retrieve the text of a control in another application". But, then I'm just assuming the OP really meant a control when he wrote it.... ;)

                    "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                    "High speed never compensates for wrong direction!" - unknown

                    1 Reply Last reply
                    0
                    • C Code o mat

                      Actually, you can use GetWindowText on windows which belong to a different process.

                      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

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

                      Please read the whole conversation before adding your comments. We're talking about a control that is owned by another process.

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

                      C 1 Reply Last reply
                      0
                      • C CPallini

                        Rajesh R Subramanian wrote:

                        Sylverster Stallone tone

                        Hey man, you're too young to remember Sly. --Carlo Rocky Rambo. :-D

                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                        [My articles]

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

                        There you go, changing your middle name again. Warm regards, Rajesh "Neo" Subramanian.

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

                        1 Reply Last reply
                        0
                        • R Rajesh R Subramanian

                          Please read the whole conversation before adding your comments. We're talking about a control that is owned by another process.

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

                          C Offline
                          C Offline
                          Code o mat
                          wrote on last edited by
                          #12

                          I did read the whole conversation, but maybe i misunderstood something...sorry about that... I thought by "window control" you meant things like buttons or edit boxes on windows, and as far as i know you are able to get the text of those, or at least some of them, some controls, like buttons allow you to query their windowtext over process boundaries, while some don't. But i guess you meant something else, sorry... :(

                          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                          R 1 Reply Last reply
                          0
                          • C Code o mat

                            I did read the whole conversation, but maybe i misunderstood something...sorry about that... I thought by "window control" you meant things like buttons or edit boxes on windows, and as far as i know you are able to get the text of those, or at least some of them, some controls, like buttons allow you to query their windowtext over process boundaries, while some don't. But i guess you meant something else, sorry... :(

                            > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

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

                            No worries, there's no need to apologise if you have read the whole conversation before adding your comments. You can have a look at the Remarks section of the respective documentation page[^] to know what I'm talking about. Here[^] is a detailed explanation. :)

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

                            C 1 Reply Last reply
                            0
                            • R Rajesh R Subramanian

                              No worries, there's no need to apologise if you have read the whole conversation before adding your comments. You can have a look at the Remarks section of the respective documentation page[^] to know what I'm talking about. Here[^] is a detailed explanation. :)

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

                              C Offline
                              C Offline
                              Code o mat
                              wrote on last edited by
                              #14

                              Thanks :)

                              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

                              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