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
Code:
CBitmap bmp;
bmp.CreateCompatibleBitmap( &memDC, bitmapWidth, bitmapHeight);
where memDC is obviously a memory DC. I need then to copy the bitmap and get a new handle. I do this by calling
Code:
HBITMAP hBitmapNew = (HBITMAP) CopyImage( (HBITMAP) bmp.GetSafeHandle(), IMAGE_BITMAP, 0, 0, LR_MONOCHROME );
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?