New to WPF. Getting frustrated
-
I am assuming this is relatively simple, but I have not been able to figure this out as of yet. I have an external WPF application that I cannot modify, but I would like to retrieve the data from a control in the application. I have the code to retrieve the application top window from the windows API and the code needed to traverse the visual tree to find child items. The problem lies in getting the window (which is contained in the HwndWrapper) into an object in my program that I can use to send to my code to find the controls I need. I have tried searching and have come up with the following: Using HwndSource.FromHwnd() - Returns Nothing Casting a custom window class to Window - Will not convert Inheriting from Window in custom window class - none of the attributes I need get populated this way. I know that this can be done, as the opensource project, snoop, is able to get the data. Unfortunately it is written in C# with a C++ ManagedInjector and I am not as proficient in these languages as I am in VB, so while I can read and understand some of it, the rest is lost on me. I truly hope that someone will be able to help me with this project, as I am ready to tear my hair out. Thanks in advance.
-
I am assuming this is relatively simple, but I have not been able to figure this out as of yet. I have an external WPF application that I cannot modify, but I would like to retrieve the data from a control in the application. I have the code to retrieve the application top window from the windows API and the code needed to traverse the visual tree to find child items. The problem lies in getting the window (which is contained in the HwndWrapper) into an object in my program that I can use to send to my code to find the controls I need. I have tried searching and have come up with the following: Using HwndSource.FromHwnd() - Returns Nothing Casting a custom window class to Window - Will not convert Inheriting from Window in custom window class - none of the attributes I need get populated this way. I know that this can be done, as the opensource project, snoop, is able to get the data. Unfortunately it is written in C# with a C++ ManagedInjector and I am not as proficient in these languages as I am in VB, so while I can read and understand some of it, the rest is lost on me. I truly hope that someone will be able to help me with this project, as I am ready to tear my hair out. Thanks in advance.
-
I am assuming this is relatively simple, but I have not been able to figure this out as of yet. I have an external WPF application that I cannot modify, but I would like to retrieve the data from a control in the application. I have the code to retrieve the application top window from the windows API and the code needed to traverse the visual tree to find child items. The problem lies in getting the window (which is contained in the HwndWrapper) into an object in my program that I can use to send to my code to find the controls I need. I have tried searching and have come up with the following: Using HwndSource.FromHwnd() - Returns Nothing Casting a custom window class to Window - Will not convert Inheriting from Window in custom window class - none of the attributes I need get populated this way. I know that this can be done, as the opensource project, snoop, is able to get the data. Unfortunately it is written in C# with a C++ ManagedInjector and I am not as proficient in these languages as I am in VB, so while I can read and understand some of it, the rest is lost on me. I truly hope that someone will be able to help me with this project, as I am ready to tear my hair out. Thanks in advance.
Hi Mr, I know few things about WPF, I can be wrong, but I vaguely remember that a WPF window do not 'use' child windows, I mean child windows do not 'exist' as in C++, Windws Forms ,etc., but really they are all together painted only on one main window. Hope this helps, Carlos.
-
Hi Mr, I know few things about WPF, I can be wrong, but I vaguely remember that a WPF window do not 'use' child windows, I mean child windows do not 'exist' as in C++, Windws Forms ,etc., but really they are all together painted only on one main window. Hope this helps, Carlos.
Thank you. I did read that the controls in a WPF application do not have handles and therefore must be traversed through with a TreeHelper/Walker, but I cannot figure out how to get the initial element to start the process. I have the names of the controls I need to find by using Inspect and Snoop, but finding the controls by name seems to require an initial element.
-
Hi Mr, I know few things about WPF, I can be wrong, but I vaguely remember that a WPF window do not 'use' child windows, I mean child windows do not 'exist' as in C++, Windws Forms ,etc., but really they are all together painted only on one main window. Hope this helps, Carlos.
Perhaps there exist another WPF code to accomplish this idea, (please excuse my English grammar, it is not my native language). Also there is no more the usual OnPaint event, it has been replaced also by OnRender or something more else, unhappiliy I don't remember now. Hope this helps, Carlos
-
Thank you. I did read that the controls in a WPF application do not have handles and therefore must be traversed through with a TreeHelper/Walker, but I cannot figure out how to get the initial element to start the process. I have the names of the controls I need to find by using Inspect and Snoop, but finding the controls by name seems to require an initial element.
-
Hi, perhaps the initial element is the biggest container, like, Canvas, InkCanvas, or it can be the main window
-
Yes, the initial element would be the main window, but obtaining that element as an object that can be used is the issue that I'm having
Hi, try google with wpf spy utility, you'll find snoopwpf on codeplex, also http://msdn.microsoft.com/en-us/library/ms742404.aspx[^], hope this helps. Well, this does not answer you question, but I suppose it could help you, also I didn't try any of these tools yet
-
Yes, the initial element would be the main window, but obtaining that element as an object that can be used is the issue that I'm having
Hi, try google with wpf spy utility, you'll find snoopwpf on codeplex, also http://msdn.microsoft.com/en-us/library/ms742404.aspx\[^\], hope this helps. Well, this does not answer you question, but I suppose it could help you, yet also I haven't not used any of these tools :)
-
Yes, the initial element would be the main window, but obtaining that element as an object that can be used is the issue that I'm having
Hi, try google with wpf spy utility, you'll find snoopwpf on codeplex, also http://msdn.microsoft.com/en-us/library/ms742404.aspx\[^\], hope this helps. Well, this does not answer you question, but I suppose it could help you, yet also I have not used any of these tools Smile | :)
-
Hi, try google with wpf spy utility, you'll find snoopwpf on codeplex, also http://msdn.microsoft.com/en-us/library/ms742404.aspx\[^\], hope this helps. Well, this does not answer you question, but I suppose it could help you, yet also I have not used any of these tools Smile | :)