Pashers Posted May 27, 2009 Posted May 27, 2009 Hi guys, I've got the following below to take a screenshot and (trying to) resize it to 800x600 which doesn't seem to work. hScreen2 comes up with a white image, hScreen comes up with the screenshot. Any ideas? Thanks, const int nScreenWidth = GetSystemMetrics(SM_CXSCREEN); const int nScreenHeight = GetSystemMetrics(SM_CYSCREEN); RECT rc; PBITMAPINFO bmfh; HWND hwndDeskTop; hwndDeskTop=GetDesktopWindow(); GetWindowRect(hwndDeskTop, &rc); HDC hdc = GetDC(hwndDeskTop); HDC hScreen,hScreen2; hScreen = CreateCompatibleDC(hdc); hScreen2 = CreateCompatibleDC(hdc); HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hdc, nScreenWidth, nScreenHeight); SelectObject(hScreen, hCaptureBitmap); BitBlt(hScreen,0,0,nScreenWidth,nScreenHeight,hdc,0,0,SRCCOPY); SetStretchBltMode(hScreen, HALFTONE); if(!StretchBlt(hScreen2,800,600,rc.right,rc.bottom,hScreen,0,0,rc.right,rc.bottom,SRCCOPY)) MessageBox(NULL,"test","", MB_OK); BitBlt(hScreen2,0,0,800,600,hdc,0,0,SRCCOPY); CreateImage(hScreen2, 800, 600); // This function just draws the image onto the screen DeleteObject(hScreen); DeleteObject(hScreen2); DeleteObject(hCaptureBitmap);
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now