Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.
These project properties give you programmatic access to the version information from the EXE Version dialog.
cVersionComments = prjProject.VersionComments
prjProject.VersionComments = cVersionComments
cVersionCompany = prjProject.VersionCompany
prjProject.VersionCompany = cVersionCompany
cVersionCopyright = prjProject.VersionCopyright
prjProject.VersionCopyright = cVersionCopyright
cVersionDescription = prjProject.VersionDescription
prjProject.VersionDescription = cVersionDescription
nVersionLanguage = prjProject.VersionLanguage
prjProject.VersionLanguage = nVersionLanguage
cVersionNumber = prjProject.VersionNumber
prjProject.VersionNumber = cVersionNumber
cVersionProduct = prjProject.VersionProduct
prjProject.VersionProduct = cVersionProduct
cVersionTrademarks = prjProject.VersionTrademarks
prjProject.VersionTrademarks = cVersionTrademarks
There’s one property for each piece of information you can store about the executable. This is the information that’s available by pressing the Version button from the Build dialog of the Project Manager—don’t confuse it with the stuff in the Project Info dialog. Once you build an EXE or DLL, you can retrieve the information with the GetFileVersion() API function or the new AGetFileVersion()
function. Then you can use it in About dialogs or wherever to tell users all about the application.
Except for VersionLanguage and VersionNumber, these items are all ordinary character fields. They accept whatever characters you send them, including multiple lines. VersionLanguage is numeric—the reasonable values are listed in FoxPro.H. There’s quite an amazing list of local variations there.
VersionNumber is different from all the others. The version number of a project has three sections, separated by periods, such as “2.17.2837”. Each section can hold up to four digits.
However, setting VersionNumber programmatically is a little strange. You must pass at least the two periods—if that’s all you pass, the first section keeps its old value, while the other two are reset to 0. If you pass more than four characters for any section, the result depends on exactly what you do. If you pass too much for the first section, the first four characters of the section are used, along with whatever you specify for the other sections. Passing too much for the second or third section results in an error message.
VersionNumber doesn't respect leading zeros in any section. For example, specifying "6.05.01" results in "6.5.1" for the version number of the EXE or DLL. There's obviously a difference between 6.05 and 6.5, so this is kind of annoying. |
oProj.Product = "My Wonderful App 98"
oProj.VersionNumber = "7.0.1"