Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void SnapCourt()
- {
- HDC hScreenDC, hCaptureDC, hSavedDC;
- HBITMAP hCaptureBmp;
- RECT rect;
- GetWindowRect(GetDesktopWindow(), &rect);
- hScreenDC = GetWindowDC(0);
- hCaptureDC = CreateCompatibleDC(hScreenDC);
- hCaptureBmp = CreateCompatibleBitmap(hScreenDC, courtRect.right - courtRect.left, courtRect.bottom - courtRect.top);
- hSavedDC = (HDC) SelectObject(hCaptureDC, hCaptureBmp);
- BitBlt(hCaptureDC, 0, 0, courtRect.right - courtRect.left, courtRect.bottom - courtRect.top, hScreenDC, courtRect.left, courtRect.top, SRCCOPY);
- ReleaseDC(0, hScreenDC);
- SelectObject(hSavedDC, hCaptureBmp);
- SaveBitmap("court.bmp", hCaptureBmp);
- DeleteObject(hCaptureBmp);
- }
Add Comment
Please, Sign In to add comment