Screen Capture Specific Window

僤鯓⒐⒋嵵緔 提交于 2019-11-28 11:02:01

Yes it is. All what you need is get handle to window which you want to capture and use WinAPI function PrintWindow for example:

// Get the window handle of calculator application.
HWND hWnd = ::FindWindow( 0, _T( "Calculator" ));

// Take screenshot.
PrintWindow( hWnd, getDC(hWnd), 0 );

Here you have PrintWindow documentation.

Deanna

Yes, Just as easy as capturing the full screen. You just use GetWindowDC() on the required window rather than GetDesktopWindow(), then BitBlt() from that to your target DC. You can also get the correct size by using GetWindowRect().

Note that this method also allows you to capture from hidden/covered windows where a full screenshot with a bounding rectangle doesn't.

See this question for some more details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!