how to caputure scrollview including unvisible area?
C / C++ / MFC
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I'd like to how caputre scrollview area, incluing unvisible area... scrollview size is nomally big than actually monito's resoluton, unvisible area don't captured...
CRect rect; HWND hWnd = m\_hWnd; // m\_hWnd is hanle of scrollview. if (hWnd == NULL) return; HDC hScrollView = ::GetWindowDC(hWnd); HDC hCaptureDC = CreateCompatibleDC(hScrollView); CRect m\_rDrawingSurface; ::GetWindowRect(hWnd,&m\_rDrawingSurface); BITMAPINFOHEADER BMIH; HBITMAP m\_hCaptureBitmap; BYTE\* m\_pDrawingSurfaceBits; CDC\* pDC = GetDC(); if(pDC != NULL) { BMIH.biSize = sizeof(BITMAPINFOHEADER); BMIH.biBitCount = 24; BMIH.biPlanes = 1; BMIH.biCompression = BI\_RGB; BMIH.biWidth = m\_rDrawingSurface.Width(); BMIH.biHeight = m\_rDrawingSurface.Height(); BMIH.biSizeImage = ((((BMIH.biWidth \* BMIH.biBitCount) + 31) & ~31) >> 3) \* BMIH.biHeight; m\_hCaptureBitmap = CreateDIBSection(pDC->GetSafeHdc(), (CONST BITMAPINFO\*)&BMIH, DIB\_RGB\_COLORS, (void\*\*)&m\_pDrawingSurfaceBits, NULL, 0); ReleaseDC(pDC); } SelectObject(hCaptureDC,m\_hCaptureBitmap); BitBlt(hCaptureDC, 0, 0, m\_rDrawingSurface.Width(), m\_rDrawingSurface.Height(), hScrollView,0, 0,SRCCOPY|CAPTUREBLT); CxImage \*image = new CxImage(); if(m\_hCaptureBitmap) { image->CreateFromHBITMAP(m\_hCaptureBitmap); bool retval; retval = image->Save("c:\\\\ss.bmp", CXIMAGE\_FORMAT\_JPG); } if (image) delete image; ::ReleaseDC(hWnd,hDesktopDC); DeleteDC(hCaptureDC); DeleteObject(m\_hCaptureBitmap); :)