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,
Code: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);



LinkBack URL
About LinkBacks
Reply With Quote
