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. Adding text in another application

Adding text in another application

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
10 Posts 3 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.
  • B Offline
    B Offline
    Baatezu
    wrote on last edited by
    #1

    I am trying to interface with another application and I want to add text to a edit box in it. I have the HWND for the window but I can't figure out how to get text to show in the box. I have tried to use WM_SETTEXT, but that isn't working. Is there another way I should be looking for to do this? Thanks. Quinn

    J 1 Reply Last reply
    0
    • B Baatezu

      I am trying to interface with another application and I want to add text to a edit box in it. I have the HWND for the window but I can't figure out how to get text to show in the box. I have tried to use WM_SETTEXT, but that isn't working. Is there another way I should be looking for to do this? Thanks. Quinn

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Is the HWND you've got the handle of the editbox, or of its parent? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      B 1 Reply Last reply
      0
      • J Joaquin M Lopez Munoz

        Is the HWND you've got the handle of the editbox, or of its parent? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        B Offline
        B Offline
        Baatezu
        wrote on last edited by
        #3

        I have both the handle to the parent and the handle to the control. I use FindWindow to get the parent and FindWindowEx to get the control HWND.

        J 1 Reply Last reply
        0
        • B Baatezu

          I have both the handle to the parent and the handle to the control. I use FindWindow to get the parent and FindWindowEx to get the control HWND.

          J Offline
          J Offline
          Joaquin M Lopez Munoz
          wrote on last edited by
          #4

          Ummm... it should work. Things you can do to locate the problem:

          1. Make sure you spotted the right parent window by sending the WM_SETTEXT message to it --the window caption should change accordingly.
          2. Make sure the handle actually belongs to the edit box using Spy++, a little utility that comes with VC++ and is able to inspect the internals of currently active windows.

          Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

          B 1 Reply Last reply
          0
          • J Joaquin M Lopez Munoz

            Ummm... it should work. Things you can do to locate the problem:

            1. Make sure you spotted the right parent window by sending the WM_SETTEXT message to it --the window caption should change accordingly.
            2. Make sure the handle actually belongs to the edit box using Spy++, a little utility that comes with VC++ and is able to inspect the internals of currently active windows.

            Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

            B Offline
            B Offline
            Baatezu
            wrote on last edited by
            #5

            I have been using SPY++, but thanks for suggesting it. That's how I made sure I had the rigth window. One of the things I've noticed with some testing is that this is a subclassed control. Also with SPY++ I can see that the control has a 'caption' to it that says 'trillian display' and when I use the WM_SETTEXT to the control it will change that value. But nothing shows anywhere. SPY++ also showz that the control class is 'trillian display' Does that help narrow down the possibilities any?

            J I 2 Replies Last reply
            0
            • B Baatezu

              I have been using SPY++, but thanks for suggesting it. That's how I made sure I had the rigth window. One of the things I've noticed with some testing is that this is a subclassed control. Also with SPY++ I can see that the control has a 'caption' to it that says 'trillian display' and when I use the WM_SETTEXT to the control it will change that value. But nothing shows anywhere. SPY++ also showz that the control class is 'trillian display' Does that help narrow down the possibilities any?

              J Offline
              J Offline
              Joaquin M Lopez Munoz
              wrote on last edited by
              #6

              I'm afraid you're out of luck. This control is not a standard edit box and seems not to be using the "caption" as the displayed message (which is how edit boxes behave). Maybe there's some custom message than can be used to set this control's content, but unless you've got additional info this is like looking for a needle in a haystack. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

              B 1 Reply Last reply
              0
              • B Baatezu

                I have been using SPY++, but thanks for suggesting it. That's how I made sure I had the rigth window. One of the things I've noticed with some testing is that this is a subclassed control. Also with SPY++ I can see that the control has a 'caption' to it that says 'trillian display' and when I use the WM_SETTEXT to the control it will change that value. But nothing shows anywhere. SPY++ also showz that the control class is 'trillian display' Does that help narrow down the possibilities any?

                I Offline
                I Offline
                includeh10
                wrote on last edited by
                #7

                i used something similar to u before, but not WM_SETTEXT. i had HWND of a window in another app, i used PostMessge to send a set of command (different numbers) for communicating between the 2 apps. i suggest u try PoseMessage(hwnd_Peer, WM_USER+???,a_number,0) first to see if another app can receive the message with a number, it should be OK. i only suspect u can't send a string from one app to another, but not sure, because COM can't send a string in this way vs its method. includeh10

                B 1 Reply Last reply
                0
                • I includeh10

                  i used something similar to u before, but not WM_SETTEXT. i had HWND of a window in another app, i used PostMessge to send a set of command (different numbers) for communicating between the 2 apps. i suggest u try PoseMessage(hwnd_Peer, WM_USER+???,a_number,0) first to see if another app can receive the message with a number, it should be OK. i only suspect u can't send a string from one app to another, but not sure, because COM can't send a string in this way vs its method. includeh10

                  B Offline
                  B Offline
                  Baatezu
                  wrote on last edited by
                  #8

                  I don't see any info on PostMesage in the MSDN, where can I find some info on that? (edit - nevermind I found the page in the msdn)

                  I 1 Reply Last reply
                  0
                  • J Joaquin M Lopez Munoz

                    I'm afraid you're out of luck. This control is not a standard edit box and seems not to be using the "caption" as the displayed message (which is how edit boxes behave). Maybe there's some custom message than can be used to set this control's content, but unless you've got additional info this is like looking for a needle in a haystack. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

                    B Offline
                    B Offline
                    Baatezu
                    wrote on last edited by
                    #9

                    Yea, that is kinda what I was thinking too. but there has to be a away, I must be able to make the computer do as I wish, hehe. So I guess I email the programmers of the program and see if they will help me any. Thanks for all your help, and if any more information about this can help me, please let me know. Quinn

                    1 Reply Last reply
                    0
                    • B Baatezu

                      I don't see any info on PostMesage in the MSDN, where can I find some info on that? (edit - nevermind I found the page in the msdn)

                      I Offline
                      I Offline
                      includeh10
                      wrote on last edited by
                      #10

                      sorry, right function name is : PostMessage (return at once) or SendMessage (return after executing). includeh10

                      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