End Google Ads 201810 - BS.net 01 -->
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); :)
مواقع النشر (المفضلة)