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. Access Controls in Other Apps

Access Controls in Other Apps

Scheduled Pinned Locked Moved C / C++ / MFC
javascriptquestion
14 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.
  • C c121hains

    Is this possible? I want to create a separate "Find Text" program that will access, read, and control a Rich Edit Control in another application. Basically what i've figured out so far is that if i somehow get the handle to the control in another application (MS Enterprise Manager), I can send messages such as EM_FINDTEXT, EM_GETSELTEXT, and EM_SETTEXTEX to it. And then i'm assuming that it will react to these messages. I do know that I can get the handle to the window application, but can i get the handle to the controls within it?

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

    c121hains wrote: I do know that I can get the handle to the window application, but can i get the handle to the controls within it? Sure. See FindWindowEx() for this.


    "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

    C 1 Reply Last reply
    0
    • D David Crow

      c121hains wrote: I do know that I can get the handle to the window application, but can i get the handle to the controls within it? Sure. See FindWindowEx() for this.


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      C Offline
      C Offline
      c121hains
      wrote on last edited by
      #3

      "The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?

      C D B 3 Replies Last reply
      0
      • C c121hains

        "The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?

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

        This hasn't fixed my problem, but take a look at this: http://delphi.about.com/od/windowsshellapi/l/aa060303a.htm[^]

        1 Reply Last reply
        0
        • C c121hains

          "The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?

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

          With the exception of the desktop, all windows are a child window. So if you already have a handle to the window of interest, you can use FindWindowEx() like:

          FindWindowEx(hWnd, NULL, class_name, NULL);

          You can find out what goes in place of class_name by using Spy++. Just open up the window having the control you want to meddle with and use Spy++ to get the control's class name.


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          1 Reply Last reply
          0
          • C c121hains

            "The FindWindowEx function retrieves a handle to a window whose class name and window name match the specified strings. The function searches child windows, beginning with the one following the specified child window." ..it searches child windows. But i'm looking for controls within a child window. Is it possible to access the controls within a child window of another application? If so, how?

            B Offline
            B Offline
            BlackDice
            wrote on last edited by
            #6

            c121hains wrote: But i'm looking for controls within a child window those controls are child windows (of the child window). I haven't used it for a while, but IIRC, you use FindWindowEx(), sending in a null as it's parent window. Find the child this time using it's parent window as one of the arguments, then find a child of that window (the controls you're talking about) by sending in it's parent as one of the arguments. get it? My articles www.stillwaterexpress.com BlackDice

            C 1 Reply Last reply
            0
            • B BlackDice

              c121hains wrote: But i'm looking for controls within a child window those controls are child windows (of the child window). I haven't used it for a while, but IIRC, you use FindWindowEx(), sending in a null as it's parent window. Find the child this time using it's parent window as one of the arguments, then find a child of that window (the controls you're talking about) by sending in it's parent as one of the arguments. get it? My articles www.stillwaterexpress.com BlackDice

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

              ahh i see! ok Thanks. I used a program called WinDowse and when i place the cursor over the (what looks like a Rich Edit box) turns out to have the class name "DimensionEdit"! Another control used in MS Enterprise Manager is "DimensionDataCtrl". If i want to send any messages to these controls (child windows), I have to know what messages they are listening to. So far i can't find any information on DimensionEdit class. Could they have created their own class by inheriting a rich edit box?

              C 1 Reply Last reply
              0
              • C c121hains

                ahh i see! ok Thanks. I used a program called WinDowse and when i place the cursor over the (what looks like a Rich Edit box) turns out to have the class name "DimensionEdit"! Another control used in MS Enterprise Manager is "DimensionDataCtrl". If i want to send any messages to these controls (child windows), I have to know what messages they are listening to. So far i can't find any information on DimensionEdit class. Could they have created their own class by inheriting a rich edit box?

                C Offline
                C Offline
                c121hains
                wrote on last edited by
                #8

                The class that i want (DimensionEdit) is within a class called "#32770" and that itself is within a "#32770" which lies within the base "MMCMainFrame" window. Everytime I run HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "#32770", NULL); It fails to bring up the correct handle! Entering in the description of the window doesn't work either. Please help!

                D 1 Reply Last reply
                0
                • C c121hains

                  The class that i want (DimensionEdit) is within a class called "#32770" and that itself is within a "#32770" which lies within the base "MMCMainFrame" window. Everytime I run HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "#32770", NULL); It fails to bring up the correct handle! Entering in the description of the window doesn't work either. Please help!

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

                  c121hains wrote: The class that i want (DimensionEdit) is within a class called "#32770"... This is the standard dialog box class.


                  "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                  C 1 Reply Last reply
                  0
                  • D David Crow

                    c121hains wrote: The class that i want (DimensionEdit) is within a class called "#32770"... This is the standard dialog box class.


                    "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                    C Offline
                    C Offline
                    c121hains
                    wrote on last edited by
                    #10

                    So.. are you saying that this would work: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); ..but in Spy++, the name of the class is #32770. If it's a dialog class, how come the order of window controls is: - DimensionEdit - #32770 - #32770 - MMCEnterprise Manager Main Window When i'm looking at it, it is - Some edit box within a tab order control within a dialog box window all within the main Enterprise Manager window. :(:(:(

                    D 1 Reply Last reply
                    0
                    • C c121hains

                      So.. are you saying that this would work: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); ..but in Spy++, the name of the class is #32770. If it's a dialog class, how come the order of window controls is: - DimensionEdit - #32770 - #32770 - MMCEnterprise Manager Main Window When i'm looking at it, it is - Some edit box within a tab order control within a dialog box window all within the main Enterprise Manager window. :(:(:(

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

                      c121hains wrote: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); Don't confuse C++ classes with window classes (those registered with RegisterClass()). See here.


                      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                      C 1 Reply Last reply
                      0
                      • D David Crow

                        c121hains wrote: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); Don't confuse C++ classes with window classes (those registered with RegisterClass()). See here.


                        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                        C Offline
                        C Offline
                        c121hains
                        wrote on last edited by
                        #12

                        I managed to finally get it working. I had to first grab the handle to the desktop and use GetNextWindow through about 200+ handles to get the one matching the partial window text that i was looking for. The dialog's window text that i wanted contained static and dynamic text. That was why i couldn't just find the window with just he window's text. Thanks for the help! :)

                        D 1 Reply Last reply
                        0
                        • C c121hains

                          I managed to finally get it working. I had to first grab the handle to the desktop and use GetNextWindow through about 200+ handles to get the one matching the partial window text that i was looking for. The dialog's window text that i wanted contained static and dynamic text. That was why i couldn't just find the window with just he window's text. Thanks for the help! :)

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

                          Once you had the handle to the dialog itself, couldn't you then have used GetDlgItem() to get the handle to the control without having to enumerate through each control on the dialog?


                          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                          C 1 Reply Last reply
                          0
                          • D David Crow

                            Once you had the handle to the dialog itself, couldn't you then have used GetDlgItem() to get the handle to the control without having to enumerate through each control on the dialog?


                            "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                            C Offline
                            C Offline
                            c121hains
                            wrote on last edited by
                            #14

                            I didn't need to. I know the class name in the dialog that i need. The problem was getting the handle to the dialog itself. I had to enumerate through the all handles at the sub desktop level.

                            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