Find Qt Window_hWnd in third party software
-
*This do get the Top Window_hWnd *
Dim Window_hWnd As IntPtr = FindWindow(Nothing, “Test Application”) ’<=Replace “Test Application”
But the ListOfChild(0), Index is 0 - there is no Child but I know there is. I want to read the text from the chat window that is part of the Top Window_hWnd
But I dont know how to search for the child windows
Top Window_hWnd = Class = QWidget -
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.... -
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)@ -
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). -
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.
-
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
-
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 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...