* comment out if Foxpro.h is part of #include stream #define CF_DIB 8 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 onFor those following this thread, here are extra functions you need to try Herman's code.
set procedure to winapi.prg Then place this in your winapi.prg program: * From: http://www.tek-tips.com/viewthread.cfm?qid=747858 function DWord2Num( pcBuffer ) local lnValue lnValue = asc( substr( pcBuffer, 1, 1 ) ) + ; asc(substr( pcBuffer, 2, 1 ) ) * 256 + ; asc(substr( pcBuffer, 3, 1 ) ) * 65536 + ; asc(substr( pcBuffer, 4, 1 ) ) * 16777216 return lnValue endFunc * Modified version of DWordNum(). function Word2Num( pcBuffer ) local lnValue lnValue = asc( substr( pcBuffer, 1, 1 ) ) + ; asc(substr( pcBuffer, 2, 1 ) ) * 256 return lnValue endFunc * Based on : http://fox.wikis.com/wc.dll?Wiki~LightweightApiStructures~VFP function Num2DWord( pnValue ) local lnByte0, lnByte1, lnByte2, lnByte3 lnByte3 = int( pnValue / 16777216 ) lnByte2 = int( ( pnValue - lnByte3 * 16777216 )/ 65536 ) lnByte1 = int( ( pnValue - lnByte3 * 16777216 - lnByte2 * 65536 )/ 256 ) lnByte0 = mod( pnValue, 256 ) return chr( lnByte0 ) + chr( lnByte1 ) + chr( lnByte2 ) + chr( lnByte3 ) endfuncHerman, thanks again for all your hard work on this thread!!!