1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
void TakeSnapshot(string directory)
{
RECT rc;
HWND hWnd2 = GetDesktopWindow();
GetClientRect(hWnd2, &rc);
HDC hScreenDC = CreateDC("DISPLAY", NULL, NULL, NULL);
HDC hMemoryDC = CreateCompatibleDC(hScreenDC);
HBITMAP hBitmap = CreateCompatibleBitmap(hScreenDC, rc.right, rc.bottom);
SelectObject(hMemoryDC, hBitmap);
BitBlt(hMemoryDC, 0, 0, rc.right, rc.bottom, GetDC(0), 0, 0, SRCCOPY);
string a = "\\";
stringstream ss;
char b[8];
ss << NOScreen;
ss >> b;
a += b;
a += ".bmp";
directory += a;
NOScreen++;
DeleteDC(hMemoryDC);
DeleteDC(hScreenDC);
}
|