"Uwe Bonnes" <bon(a)elektron.ikp.physik.tu-darmstadt.de> wrote:
> if ((res = CreateBitmapIndirect(&bm)))
> {
> - char *buf = HeapAlloc( GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight );
> + LONG size = GetBitmapBits( hnd, 0, NULL );
> + char *buf = HeapAlloc( GetProcessHeap(), 0, size );
> GetBitmapBits( hnd, bm.bmWidthBytes * bm.bmHeight, buf );
> - SetBitmapBits( res, bm.bmWidthBytes * bm.bmHeight, buf );
> + SetBitmapBits( res, size, buf );
This doesn't look right. You need to call GetBitmapBits the second time
with "size" returned from a previous GetBitmapBits call, just like you do
in SetBitmapBits.
--
Dmitry.