We have a C # application (WPF) in which we want to take a screenshot of an arbitrary application we launch (i.e., we have a link to the process that we started). An application can be minimized or behind other windows, but we still only need an image of a separate application, and not overlapping pixels.
I know typical P / Invoke solutions using BitBlt or PrintWindow work most of the time, but they don’t work (I get only black / transparent pixels) when working with a DirectX or OpenGL application that accesses a graphics device directly. I found this article about taking a screenshot of a Direct3D application with C #, so I think I have this case.
So my question is:
- How do I do this for an OpenGL application?
- What is the easiest way to determine the appropriate method to use (PW / DX / GL)?
- Is there one universal way to do this?
For # 2, I stepped back to check the modules loaded by the executable, and looked if DirectX or OpenGL DLL / assembly was loaded?
This needs to be run only on Windows XP (not cross-platform and not migrate to Vista / 7 anytime soon, if ever for this application).
source
share