Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Find Qt Window_hWnd in third party software
Forum Updated to NodeBB v4.3 + New Features

Find Qt Window_hWnd in third party software

Scheduled Pinned Locked Moved Language Bindings
18 Posts 5 Posters 11.5k 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.
  • G Offline
    G Offline
    giesbert
    wrote on 26 Nov 2010, 10:39 last edited by
    #7

    If the top window is a AWidget and it uses the default since QT 4.4 (i think it's default), there are no real child windows. And you can't read thje text out with default windows Events. Qt does not use MS Window types for edit fields etc, they are all build in Qt as they must be identical throuout the different platforms...
    So I think, the only option would be MSAA...
    If the app added MSAA support....

    Nokia Certified Qt Specialist.
    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on 26 Nov 2010, 10:42 last edited by
      #8

      hi Buyer_SA, can you pls enclose your code with the @ tag ... easier to read

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Buyer_SA
        wrote on 26 Nov 2010, 12:22 last edited by
        #9

        This is not the full code and will not do anything in this state If you need more of the code ask

        What is MSAA

        @Dim Window_hWnd As IntPtr = FindWindow(Nothing, “Test Application”) ’<=Replace “Test Application”
        Dim MaxTextLength As Integer = SendMessageA(ListOfChild(0), WM_GETTEXTLENGTH, IntPtr.Zero, IntPtr.Zero) + 1
        Dim Pointer As IntPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(MaxTextLength)
        Dim TextLength As Integer = SendMessageA(ListOfChild(0), WM_GETTEXT, CType(MaxTextLength, IntPtr), Pointer)@

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Buyer_SA
          wrote on 26 Nov 2010, 12:33 last edited by
          #10

          How will you go about it to get the text from Widget

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on 26 Nov 2010, 12:40 last edited by
            #11

            MSAA = Microsoft Accessibility Support
            A posibility to auery windows including their states and children. Qt has support for that, if the app added it. I see no other chance to get text out of a QWidget from outside the process. Default windows API calls will not work (as GetWindowText).

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Buyer_SA
              wrote on 27 Nov 2010, 08:08 last edited by
              #12

              What about something like this

              @Dim widget As Pointer(Of QWidget) = QWidget.find(DirectCast(hwnd, WId))
              Dim listview As Pointer(Of QListView) = DirectCast(widget, QListView)
              Dim model As QAbstractItemModel = listview.model()@

              Or

              using QObject::children() which returns, a list of all the children of any QObject.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on 27 Nov 2010, 08:49 last edited by
                #13

                As you are in VB, you have no access to Qt Code (thats C++).
                Or what are you trying to do?

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  Buyer_SA
                  wrote on 27 Nov 2010, 14:42 last edited by
                  #14

                  Do you have C++ code that can get Qt text for third party Software.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    giesbert
                    wrote on 27 Nov 2010, 16:07 last edited by
                    #15

                    You have no chance to get the text out of third party. Only if it supoports MSAA (Microsoft Active Accessibility). That's what I told you some posts up. But as you suggested to use Pointer(Of QWidget) = QWidget.find(DirectCast(hwnd..., I said that those classes are only for C++.
                    But from outside of the process, it's getting difficult. For "normal" Win32 windows classes there are possibilities, but QWidgets do not depend on "normal" Win32 window types.

                    So, again: try out using MSAA (search "http://msdn.microsoft.com":http://msdn.microsoft.com for it).

                    For examples on how to program that, you can also look at: "http://www.codeproject.com/KB/winsdk/MSAA_UI_Automation.aspx":http://www.codeproject.com/KB/winsdk/MSAA_UI_Automation.aspx

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pmcfrack
                      wrote on 16 Mar 2011, 20:09 last edited by
                      #16

                      I know this is a rather old post, however, this is the exact problem I am trying to work around. Here is a link to my question: http://developer.qt.nokia.com/forums/viewthread/4402/#26159

                      Does anyone have a work around for this?

                      Thanks!

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on 17 Mar 2011, 07:54 last edited by
                        #17

                        What does getting data from widgets have to do with getting window handles?

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          andre
                          wrote on 17 Mar 2011, 09:06 last edited by
                          #18

                          [quote author="pmcfrack" date="1300306178"]I know this is a rather old post, however, this is the exact problem I am trying to work around. Here is a link to my question: http://developer.qt.nokia.com/forums/viewthread/4402/#26159

                          Does anyone have a work around for this?

                          Thanks![/quote]

                          Perhaps you should start responding in that thread then again? It is not like you did not get any reactions there...

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved