C Program To Copy Screen To HBITMAP Object
C Program To Copy Screen To HBITMAP Object
The following code segment can be used to copy a portion or full screen in to a
HBITMAP GDI object in visual C++. This code is tested on Visual C++ 6.0
nX = x1;
nY = y1;
nX2 = x2;
nY2 = y2;
if (nX < 0)
nX = 0;
if (nY < 0)
nY = 0;
if (nX2 > xScrn)
Saturn Software Mills
Visit for more technical article http://www.saturnsoftmills.com/FreeDownloads.htm
nX2 = xScrn;
if (nY2 > yScrn)
nY2 = yScrn;
if(hOldBitmap == NULL)
{
AfxMessageBox("Can not select old object");
return NULL;
}
// select old bitmap back into memory DC and get handle to bitmap of the screen
return hBitmap;
}