I know I can get the screenshot of the entire screen using Graphics.CopyFromScreen(). However, what if I just want the screenshot of a specific application?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Based on Alconja's answer, I made a few improvements:
The PrintWindow win32 api will capture a window bitmap even if the window is covered by other windows or if it is off screen:
The reference to RECT above can be resolved with the following class:
You could look into P/Invoking the win32 way of doing this, an article to this effect... sort of.
Basically, go through the trouble of setting up a DC to a bitmap and send WM_PRINT to the application window in question. Its pretty nasty, all told, but may work for you.
Functions you may need: SendMessage, GetDC, CreateCompatibleBitmp, and SelectObject.
I can't say I've ever done this before, but this is how I'd attack the problem. (Well, I'd probably do it in pure C but still; roughly the way I'd attack it).
Here's some code to get you started:
It works, but needs improvement: