Re: Copy CImage to clipboard
Quote:
Originally Posted by
jcjc
Code:
HANDLE hData = ::GlobalAlloc (GMEM_MOVEABLE, sizeof(BITMAPINFO) + w * h * 3);
// ...
DWORD dwBytes = ((DWORD) w * Bpp) / 32;
if(((DWORD) w * Bpp) % 32) {
dwBytes++;
}
dwBytes *= 4;
unsigned long m_dwSizeImage = dwBytes * h; // no compression
// ...
memcpy (p_imagebits, pBits, m_dwSizeImage);
How many bytes did you allocate and how many are you copying?
Re: Copy CImage to clipboard
CImage::GetBits:
Quote:
Return Value
A pointer to the bitmap buffer. If the bitmap is a bottom-up DIB, the pointer points near the end of the buffer. If the bitmap is a top-down DIB, the pointer points to the first byte of the buffer.