Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting window's contents with bitblt without layered windows 1

Status
Not open for further replies.

Sen7inel

IS-IT--Management
Feb 14, 2001
90
FI
I'm trying to copy all pixels from a window's DC for some processing. I GetDC() the dc, and then use BitBlt to copy the pixels to a dc I created with CreateCompatibleDC. This works fine, except for the fact that the window must actually be visible (the app can't be minimized), and any other windows on top of the window that is being copied, is included in the copy.

How can I access the pixel data belonging ONLY to the window I want to copy the pixels from? I use SRCCOPY only, not CAPTUREBLT, as the raster operation.
 
When a window is minimized or covered, it has no pixel data. That's why WM_PAINT is sent to a window whenever it is uncovered, so that the application can fill in the pixel data. If WM_PAINT is not handled, or does not paint the window, the window will appear to have whatever was there in the same position on the screen before. You'll notice this if an application freezes and you drag another window over its frozen window.

Some applications have double-buffered windows, where the WM_PAINT handler merely copies pixel data from an off-screen buffer, where the window's contents are actually drawn. Unfortunately, every application is free to implement this kind of back buffer any way they want to.
 
Ok.. I'll try to do it with an off-screen DirectDrawSurface then.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top