MSI Factory 2.3

String.CompareFileVersions

String.CompareFileVersions

This is the first topic This is the last topic  

String.CompareFileVersions

This is the first topic This is the last topic  

OverviewExamples

number String.CompareFileVersions (

string Version,

string CompareTo )

Example 1

compare_version = String.CompareFileVersions("1.0.20.3", "1.0.2.3");

Compares the file version string "1.0.20.3"  to version "1.0.2.3" and stores the result in the variable "compare_version." Since "1.0.20.3" is greater than "1.0.2.3", the number 1 would be returned.

Example 2

IsBigger = String.CompareFileVersions("1.0.0.1", "1.0.0.1");

Compares the file version "1.0.0.1" to "1.0.0.1" and stores the result in the variable "IsBigger." Since the version strings are identical, the number 0 would be returned.

Example 3

-- Get the current OS Version information

tVersionInfo = System.GetOSVersionInfo();

 

-- Combine Version information into a file-version string

sCurrentWindowsVersion = tVersionInfo.MajorVersion .. "." .. tVersionInfo.MinorVersion.. "." .. tVersionInfo.BuildNumber;

 

-- Specify the minimum required file version

sRequiredWindowsVersion = "4.10.2222A";

 

-- Compare the current file version to the minimum requirement

nCompareResult = String.CompareFileVersions (sRequiredWindowsVersion, sCurrentWindowsVersion);

 

-- If the minimum requirement is greater than the current version, display an error and exit.

if (nCompareResult == 1) then

   Dialog.Message("Error", "Windows 98 Second Edition or newer is required to use this software.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);

   Application.ExitScript();

end

Gets the Operating System's version information, and compares it to a minimum value.  If the installed operating system is not Windows 98 Second Edition or newer (version 4.10.2222A or newer), an error message is displayed.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us