this the code i use to take snap shot of my screen and crop it to the rect i want.. then save as jpeg...
works fine on single monitor... how can i change this to work on dual monitors...
Code:
HDC WinDC;
HDC CopyDC;
HBITMAP hBitmap;
ULONG bWidth,bHeight;
WinDC = ::GetDC(NULL);
CopyDC = CreateCompatibleDC(WinDC);
bWidth = GetDeviceCaps(WinDC, HORZRES);
bHeight = GetDeviceCaps(WinDC, VERTRES);
hBitmap = CreateCompatibleBitmap(WinDC,bWidth,bHeight);
SelectObject(CopyDC,hBitmap);
BitBlt(CopyDC,0,0,bWidth,bHeight,WinDC,0,0,SRCCOPY);
::ReleaseDC(NULL,WinDC);
DeleteDC(CopyDC);
HDC hSrc = CreateCompatibleDC(NULL);
SelectObject(hSrc,hBitmap);
HDC hNew = CreateCompatibleDC(hSrc);
HBITMAP hBmp = CreateCompatibleBitmap(hSrc,width,height);
HBITMAP hOld = (HBITMAP)SelectObject(hNew,hBmp);
BitBlt(hNew,0,0,width,height,hSrc,left,top, SRCCOPY);
SelectObject(hNew,hOld);
//code to save jpeg here....
DeleteDC(hSrc);
DeleteDC(hNew);
DeleteObject(hOld);
DeleteObject(hBmp);
DeleteObject(hBitmap);
Bookmarks