20 Sep
2005
20 Sep
'05
11:48 a.m.
"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.