GetOSVersion
Previous  Top  Next


Function GetOSVersion()

This function returns information about the current version of Windows

No Parameters

Returns:
This function returns a string in the following format:  
MAJOR.MINOR.BUILD_NUMBER.PLATFORM_ID OS_STRING  
 
MAJOR is one the following values  
Windows Server 2003
5
Windows XP
5
Windows 2000
5
Windows NT 4.0
4
Windows Me
4
Windows 98
4
Windows 95
4
Windows NT 3.51
3
 
 
MINOR is one of the following values  
Windows Server 2003
2
Windows XP
1
Windows 2000
0
Windows NT 4.0
0
Windows Me
90
Windows 98
10
Windows 95
0
Windows NT 3.51
51
 
 
BUILD_NUMBER is the build number of the OS  
Windows Me/98/95: The low-order word contains the build number of the operating system. The high-order word contains the major and minor version numbers.  
 
PLATFORM_ID is one of the following values  
Value = 1 for Windows Me, Windows 98, or Windows 95 (Windows 95 based OS)  
Value = 2 for Windows Server 2003, Windows XP, Windows 2000, or Windows NT. (Windows NT based OS)  
 
OS_STRING Represents additional information about the OS such as "Service Pack 2"  

Example:

if GetOSVersion() = "5.1.0.2 Service Pack 2" then  
MsgBox "You are running on Windows XP Service Pack 2!"  
endif