January 28th, 2010, 03:18 AM
Why does CopyImage fail?
Hi, in my program I create several dozen of quite big monochrome bitmaps (approx. 6000 x 1500 pixels). This is done in a standard way by calling
where memDC is obviously a memory DC. I need then to copy the bitmap and get a new handle. I do this by calling
bmp.CreateCompatibleBitmap( &memDC, bitmapWidth, bitmapHeight);
However, the CopyImage method often fails and GetLastError returns 8 which means "not enough memory". What confuses me the most is that after this unsuccessful call I can happily create other bitmaps of the same size with the CreateCompatibleBitmap method. When there is not enough memory to copy a bitmap, shouldn't there be also not enough memory to create it? Or is there any other reason why CopyImage fails?
HBITMAP hBitmapNew = (HBITMAP) CopyImage( (HBITMAP) bmp.GetSafeHandle(), IMAGE_BITMAP, 0, 0, LR_MONOCHROME );
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!