This sample shows how to save a registration key -- actually it can be any kind of data -- in the resources of VFP executable file after its compilation.
Choose an executable file to test this code with. Consider that its modification date and the file size may change due to the testing. Also note that Win32 process -- afaik -- cannot modify its executable file.
As the Win32 executable, the FoxPro application is able to access resources by their types and identifiers using API calls. There is a limitation: an executable can not modify its own resources. To add or modify resource data in an application a separate loader utility is required.
You know about "Other Files" section inside the Project Manager. I think, that would be handy to have a similar section named "Resources", where files like icons, bitmaps, sounds, strings and others could be added. And after the file compiled into an executable, they could be reached through the Resource API calls LoadResource, LoadString, LoadImage and so on.
* * *
At first, this code truncated each and every VFP executable it was applied to, making the executables unusable. Everything in the code seemed to be correct, all API functions were called properly. The problem appeared to be with the VFP executable format itself.