RECT rect = {0};
GetWindowRect( hwnd, &rect );
ATL::CImage* image_ = new CImage();
image_ -> Create( rect.right - rect.left, rect.bottom - rect.top, 32 );
HDC device_context_handle = image_ -> GetDC();
PrintWindow( hwnd, device_context_handle, PW_CLIENTONLY );
image_ -> Save( filename );
image_ -> ReleaseDC();
delete image_;
PrintWindow()
должно сработать.
Чтобы сохранить как HBITMAP:
HDC hDC = GetDC( hwnd );
HDC hTargetDC = CreateCompatibleDC( hDC );
RECT rect = {0};
GetWindowRect( hwnd, &rect );
HBITMAP hBitmap = CreateCompatibleBitmap( hDC, rect.right - rect.left,
rect.bottom - rect.top );
SelectObject( hTargetDC, hBitmap );
PrintWindow( hwnd, hTargetDC, PW_CLIENTONLY );
SaveBMPFile( filename, hBitmap, hTargetDC, rect.right - rect.left,
rect.bottom - rect.top );
DeleteObject( hBitmap );
ReleaseDC( hwnd, hDC );
DeleteDC( hTargetDC );
Я оставлю реализацию SaveBMPFile на ваше усмотрение; ) * +1010 *