Find Qt Window_hWnd in third party software
-
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...