I am using an application, which I know, is c# with WPF. I want to grab data from some of its windows. In detail, i want to grab a grid with all content and the header. If I do copy+paste, i just get all content, but no headers.

Is there any way to connect to the process and get a handle to the control and access the controls data (without doing ocr or some other screen-capturing things) native in .net?

I know how to get a handle to the window, and the form itself just contains this grid, so if i have the window as any kind of .net-object, i will soon get the grid. The question is, if I can get to the window as .net-"native"-object.


2 Answers 2


What do you mean by:

The question is, if I can get to the window as .net-"native"-object.

All of WPF window is implemented as .NET object. Therefore any objects placed on the WPW window is .NET object, as long as the object is also .NET object. There's no native .NET object, because native in .NET means Microsoft Windows native API (or the underlying OS API).

You can hook into a .NET application (and examine all of the objects inside of the application) as long as it's executable and not compiled in .NET Core. But hooking into a .NET application is a very difficult and tedious task, and you can hook into any .NET application easier by using Visual Studio debugger because what you are trying to accomplish is actually creating a debugger. Visual Studio debugger can be attached to any .NET running applications including WPF and Windows Forms.


Not all WPF controls have Window handles, only some controls at the base of the visual stack have them (like the Window). Consequently, you cannot use the pinvoke way of getwindowtext etc. here.

Since some "assistive technologies" like screen readers may need to access the contents, I'd suggest to look into this field to get further ideas on how to access the controls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.