Захват изображения? Наверное.
Эта функция создаст битмап с изображением с контекста устройства.
Я хотел сказать:
The following function creates a bitmap with the image of the input device context:
BOOL CaptureImage(HDC hDC, LPRECT lpRect, HBITMAP& hBitmap)
{
HDC hMemDC = CreateCompatibleDC(hDC);
BITMAPINFO bmi = { 0 };
LPBYTE pBits = NULL;
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = lpRect->right - lpRect->left;
bmi.bmiHeader.biHeight = lpRect->bottom - lpRect->top;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
hBitmap = ::CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS,(void **)&pBits, NULL, 0);
HGDIOBJ hOld = SelectObject(hMemDC, hBitmap);
::BitBlt(hMemDC, 0, 0,
lpRect->right - lpRect->left,
lpRect->bottom - lpRect->top,
hDC, lpRect->left, lpRect->top, SRCCOPY);
SelectObject(hMemDC, hOld);
DeleteDC(hMemDC);
return TRUE;
}
Вариант этой статьи на Experts-Exchange:
Win32: Capture an image
No comments:
Post a Comment