Capturing contents of non-visible window 
Author Message
 Capturing contents of non-visible window

I have a COM Server .exe that contains a window to
which I draw. This can be done either with the window visible,
invisible or obscured.  I need to capture the drawn image and
export it to a file.  For this I need an HBITMAP of the image.
Here's the code:

void CopyToFile(CWnd *pWnd)
{
   CWindowDC dc(pWnd);
   CDC   memDC;
   CRect  rect;
   memDC.CreateCompatibleDC(&dc);
   HBITMAP hBitmap;
   CBitmap bmp;

   pWnd->GetWindowRect(rect);
   bmp.CreateCompatibleBitmap(&dc, rect.Width(),rect.Height());
   CBitmap* pOldBitmap = memDC.SelectObject(&bmp);
   memDC.BitBlt(0, 0, rect.Width(),rect.Height(), &dc, 0, 0, SRCCOPY);

   hBitmap = (HBITMAP)bmp;

    /* Transfer to .jpg */

   memDC.SelectObject(pOldBitmap);

Quote:
}

The problem is that the image is always of whatever happens
to be on the desktop in the position of my window (Source editor,
Explorer, etc.).  I think there must be a way to get the actual
image that has been drawn to my window and not just what is on
the screen at that moment.  How?

Thanks,
Drew



Tue, 12 Aug 2003 03:04:46 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. how to screen capture non visible area

2. Capturing window contents of hidden window

3. Entire Contents of Window Visible??

4. Printing non visible dialog windows

5. how to get something of a non visible window

6. Is it possible to capture the visible richeditview text

7. Capturing contents in external apps with RichEdit control

8. Capture Screen Content in VC

9. Non-resizeable and non-moveable window

10. Does DSOFile.dll support non-English content?

11. How parent window captures message destined to child window

12. Capture window contents to bitmap (mem DC) when window is off the screen???

 

 
Powered by phpBB® Forum Software