>Hi Herman,
>
>After reviewing the code posted on MSDN and running some test data, I've come to the conclusion that writing a parser to convert BIMAPINFO structures may be too complicated given the variety of palette types one might encounter.
>
>News2News has some great code for converting DIB orientated BTMAPINFO structures to various image formats via the News2News GDIPLUS class. The News2News solution requires a HANDLE to DIB BITMAP info - not the raw DIB BITMAP info itself.
>
>So I'm going to post in the Windows API section of the UT asking for ideas on how to convert a BITMAPINFO data stream to a DIB handle.
>
>I think I'm getting close. Thanks for all your help. And yes I will post my solution in the downloads section so others might benefit.
>
>Regards,
>Malcolm
Hi Malcolm,
I just played around with the returned DIB data. Try this:
lcData = oDataObject.GetData( CF_DIB )
nBISize = DWord2Num( substr( lcData, 1, 4 )) + DWord2Num( substr( lcData, 21, 4 ))
nBPP = Word2Num( substr( lcData, 15, 2 ))
If (nBPP < 24)
nColorUsed = DWord2Num( substr( lcData, 33, 4 )) * 4
nBISize = nBISize + nColorUsed
cBmpData = 'BM' + Num2DWord(14 + nBISize ) + replicate( chr(0), 4 ) + ;
Num2DWord( 54 + nColorUsed ) + left( lcData, nBISize )
else
cBmpData = 'BM' + Num2DWord(14 + nBISize ) + replicate( chr(0), 4 ) + ;
Num2DWord( 54 ) + left( lcData, nBISize )
endif
Set safety off
StrToFile( cBmpData, 'Test.BMP' )
Set safety on
Hope it works
Herman