how to capture a big window?
-
i want to capture a window to a bitmap. when the document size is bigger than current viewable rectangle, if using the document size to the captured image will has a big black block.
CSize size = GetTotalSize(); CClientDC dc(this); CDC memDc; if(!memDc.CreateCompatibleDC(&dc)) { return ; } CBitmap bitmap; if( !bitmap.CreateCompatibleBitmap(&dc, size.cx, size.cy) ) { return ; } CBitmap* pOldBitmap = memDc.SelectObject(&bitmap); memDc.BitBlt(0, 0, size.cx, size.cy, &dc, 0, 0, SRCCOPY ); if( OpenClipboard() ) { EmptyClipboard(); SetClipboardData(CF_BITMAP, bitmap.GetSafeHandle()); CloseClipboard(); } memDc.SelectObject(pOldBitmap);
any suggestion or tips will be great help. thank you in advance. -
i want to capture a window to a bitmap. when the document size is bigger than current viewable rectangle, if using the document size to the captured image will has a big black block.
CSize size = GetTotalSize(); CClientDC dc(this); CDC memDc; if(!memDc.CreateCompatibleDC(&dc)) { return ; } CBitmap bitmap; if( !bitmap.CreateCompatibleBitmap(&dc, size.cx, size.cy) ) { return ; } CBitmap* pOldBitmap = memDc.SelectObject(&bitmap); memDc.BitBlt(0, 0, size.cx, size.cy, &dc, 0, 0, SRCCOPY ); if( OpenClipboard() ) { EmptyClipboard(); SetClipboardData(CF_BITMAP, bitmap.GetSafeHandle()); CloseClipboard(); } memDc.SelectObject(pOldBitmap);
any suggestion or tips will be great help. thank you in advance.A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
You can use the
PrintWindow
function to do this I believe.Steve
-
You can use the
PrintWindow
function to do this I believe.Steve
-
A window only renders if it's on the visible area. Grabbing outside your desktop just isn't going to do anything.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog