Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extact image from general field into file
Message
 
To
31/12/2001 10:18:06
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00599253
Message ID:
00599510
Views:
21
In fact I did not use any API functions. It is done by couple lines of simple code, that you can see below. This code I used to use in my App FRX2ANY.ZIP
in order to extract BMP image from Gen field into file. If you will find something that can be improved, let me know.
Best wishes

*****************************************************************************
LPARAMETERS tcGenFldName

LOCAL lnInHandle
LOCAL lnOutHandle
LOCAL lnFileLen

LOCAL lcTmpFile
LOCAL lcBmpFile
LOCAL lcString

LOCAL loResult
LOCAL lcOldComp

lcTmpFile = ADDBS(SYS(2023)) + SYS(2015)
lcBmpFile = ADDBS(THIS.cReportPath) + SYS(2015) + '.BMP'

COPY TO (lcTmpFile) FIELDS (tcGenFldName) NEXT 1

lnInHandle = FOPEN(lcTmpFile + '.FPT')
lnOutHandle = FCREATE(lcBmpFile)

IF lnInHandle >0 AND lnOutHandle > 0

lnFileLen = FSEEK(lnInHandle, 0, 2)
= FSEEK(lnInHandle, 0)

lcString = FREAD(lnInHandle, lnFileLen)
lcString = RIGHT(lcString, LEN(lcString) - 599)
=FWRITE(lnOutHandle, lcString)
ELSE
lcBmpFile = ''
ENDIF

=FCLOSE(lnInHandle)
=FCLOSE(lnOutHandle)

IF FILE(lcTmpFile + '.FPT')
DELETE FILE (lcTmpFile + '.*')
ENDIF

RETURN lcBmpFile
******************************************************************************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform