Maybe we should clarify a general field isn't a Blob field.
It's very specific to MS. The only other place I know it is in Access as OLE Object fields, they are about the same as a VFP general field.
In the case of BMP, it just happens the original BMP file is part of the Gen field content, I faintly remember that is the case and it's prepended by a thumbnail. Aside from that, an FPT file has a header, That altogether might make it possible to find the BMP content after 599 bytes, but that's not a constant and it's even not generally true you can get back the original file or an equivalent. General fields are typically bloating the content of a file. Just imagine how any imaging software reads in any picture, a typical JPG, which is compressed, into the uncompressed format orf RGB pixels in memory. That plus some software-specific overhead makes an OLE image object, and only in case, an imaging software makes use of the OLE idea at all. Most modern imaging software will rather handle a picture as a byte array or such low-level things and co-works with graphics card drivers even circumventing the GDI structures about Graphics and Bitmaps.
The code you posted stripes off FPT header and likely the thumbnail of a BMP in a general field and so gets at the core content. But that's only possible when the OLE object is almost just like the original file. I guess if you store a JPG you could get back a BMP worth a try, just to prove how the content of a general field degrades from what the file was. In the case of images, you could at least go back once you know it's becoming a BMP.
And to make it even clearer: This doesn't work with any file having a file association with a software, it has to be an association with an OLE Server, because what VFP stores is the OLE object data itself, the idea is, once you have that you can skip all the steps from what's stored in the file to how it's represented in memory as an OLE object, VFP and its Olebound control then bind the OLE object to the Ole Server and that shows it.
But this and the nature of these OLE object contents makes such data dependent on a computer, sometimes with non-normal solutions even just this one computer. The most famous way to let General field content work on a newer computer is by reestablishing the association of BMP files with an MS Paint Ole Server. But that also just solves the problem for BMP content, not for any content.
I haven't said this for a long time, and last time I said it this was also already advice previous experts gave for a very long time already: Don't use Gen fields except as temporary usage for Olebound controls. Always stay with the files and keep them.
Not your fault, but you're almost up to yourself knowing how an ESD file structure is defined to maybe find a header within the FPT file your code generates with COPY TO tmpTable FIELDS YourGeneralField NEXT 1. Identify the byte offset where a typical ESD file header begins and try to save from that position to the end as a new file. That's the only chance you have from the DBF file alone.
The other thing is on the computer the DBF/FPT originated from, the general field should work and show whatever Ole object content in an Olebound control. Sometimes even interactive. For example, storing a Word,Document in a general field and displaying that in an Olebound control in VFP together with Word installed can enable this to become an editable Word document within a VFP form. And in that case, you may copy that out into a Word instance and save as word document. Similarly, some images might become zoomable content in an Olebound control. then you might maximize that and get out an image in BMP, GIF, PNG or JPG format as a screenshot.
Since that or similar things typically work, some people will never listen to the advice, but you a) really lose the original file and b) depend not only on VFP the table and OleBound control but also other software and often ole servers you don't even know, no matter if you populate a general field with APPEND GENERAL... DATA... CLASS... clause or FROM Filename. When you just specify a filename what happens is still finding out which Ole Server is associated with that file type and that's used to create the ole object that's finally stored. The same happens when you add an Ole control on a VFP form and choose to create the Ole object from a file.
Bye, Olaf.
Olaf Doschke Software Engineering