I found this piece of code from fox newsgroup.
I haven't tested it.
*------------------------------------
* Program....: CopyGen
* Author.....: Martín Salías (with special thanks to Raymond Krauss)
* Date.......: 19/18/98
* Notes......: Replace the missing command COPY GENERAL
* Parameters.: tcTable, tcField = Table & Field
* Parameters.: tcBMPFileName = Filename to generate (if no extension
supplied, BMP is assumed)
* Returns....: The lenght of the generated file (in bytes)
* See Also...:
*
lparameters tcTable, tcField, tcBMPFileName
local lnReturn, lcSaveArea
lnReturn = 0
lcSaveArea = SaveArea()
if used( tcTable )
if tcBMPFileName $ "."
* se pasó con extensión
else
* Se agrega la extensión BMP
tcBMPFileName = allt( tcBMPFileName ) + ".bmp"
endif
local lcTempFile
lcTempFile = sys(2023) + "\" + sys(3)
select ( tcTable )
copy next 1 to ( lcTempFile ) field ( tcField )
lcMemoFileName = lcTempFile + ".fpt"
if file( lcMemoFileName )
local lnFPT, lnBMP
lnFPT = fOpen( lcMemoFileName, 10 ) && Open the memo file
lnBMP = fCreate( tcBMPFileName ) && Create the new image file
if lnFPT > 0 and lnBMP > 0 && If both files are open
local lnSize, lnPointer
lnSize = fSeek( lnFPT, 0, 2 ) && Find the total size of the memo
lnPointer = fSeek( lnFPT, 0 ) && Return to the beginning
* PROBLEM, PROBLEM; fRead can't read more than 64K at once, so we have to
* read the whole picture on 64K blocks.
*
local lnBytesLeft, lcReadBuffer, lnBytesToRead
lnBytesLeft = lnSize
lcReadBuffer = ""
do while lnBytesLeft > 0
lnBytesToRead = iif( lnBytesLeft > 65535, 65535, lnBytesLeft )
lnBytesLeft = lnBytesLeft - lnBytesToRead
* Gets the binary data of the image
lcReadBuffer = lcReadBuffer + fRead( lnFPT, lnBytesToRead )
enddo
local lnBMPStart, lcWriteBuffer
lnBMPStart = at( 'BM', lcReadBuffer ) && find start of a BMP file
* Put the rest of the binary data on the buffer
lcWriteBuffer = right( lcReadBuffer, len( lcReadBuffer ) - lnBMPStart +
1 )
lnReturn = fWrite( lnBMP, lcWriteBuffer ) && write to BMP file
endif
fClose( lnFPT ) && close files
fClose( lnBMP )
delete file ( lcTempFile + ".*" )
endif
endif
RestArea( lcSaveArea )
return lnReturn
*-------------------------------*
Regards,
Mr. Man-wai Chang