
June 26th, 2003, 01:27 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
|
|
Something like this perhaps
Code:
void CaptureImage(void)
{
HDC hDC;
// First get the Device Context of the desktop
hDC = GetDC(NULL);
// Now get the screen size
SIZE size;
size.cx = GetSystemMetrics(SM_CXSCREEN);
size.cy = GetSystemMetrics(SM_CYSCREEN);
// Now do a BitBlt
HDC hMemDC = CreateCompatibleDC(hDC);
HBITMAP hBitmap = CreateCompatibleBitmap(hDC, size.cx, size.cy);
if (hBitmap) {
HBITMAP hOldBmp = (HBITMAP) SelectObject(hMemDC, hBitmap);
BitBlt(hMemDC, 0, 0, size.cx, size.cy, hDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hOldBmp);
DeleteDC(hMemDC);
// hBitmap is now a handle to the screen capture.
// Do what you want with it here, before deleting it below.
DeleteObject(hBitmap);
}
ReleaseDC(NULL, hDC);
}
The last part was off the top of my head and I haven't really tested it, but it should be pretty close to The Right Thing. Hope this helps 
Last edited by Scorpions4ever : June 26th, 2003 at 01:30 AM.
|