Storages & Files GetVersionInfo
GetVersionInfo method 

Returns a tree of collections (VarDictionary) filed with the complete version information in the file.


Set variable = object.GetVersionInfo( file)


file - full physical path and file name. If the file contains version information it is extracted and returned (see below)

returned collection:

The returned tree contains all the version data about the file. The method never fails instead the result is reported in the collection itself. The returned data tree is compatible with the ConfigFile object and can be stored/sent through it. Suppose the following line has been exectued:

Set vi = o.GetVersionInfo(some_file_path

The result will contain:

vi("Result") - integer 0 - if version information cannot be extracted, 1 - if successful
vi("ResultDescription") - String describing the result of the operation.

If version information is avaiable:
- integer: system supplied signature (see MSDN for details - not useful for scripting applications)
vi("Version") - Record containing the 4 version values:

Set v = vi("Version")
v(1) -
Major version, high significant. (The value can be referred also as: v("MajorMS")
v(2) - Major version, less significant. (The value can be referred also as: v("MajorLS")
v(3) - Minor version, high significant. (The value can be referred also as: v("MinorMS")
v(4) -
Minor version, less significant. (The value can be referred also as: v("MinorLS")

vi("VarFileInfo")("Translation") - contains a list of values describing the contained version information sections (see below). 

Set t = vi("VarFileInfo")("Translation")
Contains a number of records with two values. The first value of each record contains the Language code, the second contains the CodePage. The names of the records are constructed as strings containing 8 digits. First 4 match the Language code, the next 4 match the CodePage. For example a record for the English version information will has these values:
t("040904b0")("Language") will contain 1033
t("040904b0")("CodePage") will contain 1200
of course the values can be referred by index as well:
t("040904b0")(1) will contain 1033
t("040904b0")(2) will contain 1200

For each record of the above list exists a section which contains the actual strings set by the vendor. It is accessed as follows:

Set v = vi("StringFileInfo")(translation
Where translation is one of the record names in the translation section. For example for the English strings it will look like:
Set v = vi("StringFileInfo")("040904b0")

The section contains some of these records (set by the vendor):
v("FileDescription") - description of the file
v("Comments") - comments
v("CompanyName") - Company name of the vendor
v("FileVersion") - File version in string representation
v("InternalName") - Internal file name
v("LegalCopyright") - Legal copyright
v("LegalTrademarks") - Treademarks
v("OriginalFilename") - original file name
v("ProductName") - Product name (the file is probably part of a product)
v("ProductVersion") - Product version in string format
v("PrivateBuild") - Private build text (rarely used)
v("SpecialBuild") - Special build notes


You cannot be sure that version information exists in English. Thus you will need to check which languages are actually present first.

Applies to: SFMain object

Supported on:

Windows 95/NT and later
Windows CE.NET 4 and later
Also available in special versions for Pocket PC 2002 and later


newObjects Copyright 2001-2006 newObjects [ ]