Difference between revisions of "Windows version"

From HashVB
Jump to: navigation, search
m (Split 95, 98, and ME)
 
(7 intermediate revisions by one user not shown)
Line 10: Line 10:
 
    
 
    
 
   Version = GetVersion()
 
   Version = GetVersion()
   WindowsVersion = (Version And &HFF&) + (((Version And &HFF00&) \ &H100)) / 100
+
   WindowsVersion = (Version And &HFF&) + (((Version And &HFF00&) \ &H100)) / 100
 
  End Function
 
  End Function
  
 
The values for each version of windows are as follows:
 
The values for each version of windows are as follows:
 
{| border="1"
 
{| border="1"
| Windows NT 3.51: || 3
+
| Windows NT 3.51 || 3
 
|-  
 
|-  
| Windows 3.1: || 3.1
+
| Windows 3.1 || 3.1
 
|-  
 
|-  
| Windows NT 4: || 4
+
| Windows NT 4 || 4
 
|-  
 
|-  
| Windows 95, 98 and ME: || 4.1
+
| Windows 95 || 4
 
|-  
 
|-  
| Windows 2000: || 5
+
| Windows 98 || 4.1
 
|-  
 
|-  
| Windows XP: || 5.01 (This is not 5.1 as Microsoft changed the format)
+
| Windows ME || 4.9
 +
|-
 +
| Windows 2000 || 5
 +
|-
 +
| Windows XP || 5.01 (This is not 5.1 as [http://www.jrsoftware.org/iskb.php?why501 Microsoft changed the format])
 +
|-
 +
| Server 2003 &<br />Windows XP x64 || 5.02
 +
|-
 +
| Windows Vista || 6
 +
|-
 +
| Windows 7 || 6.01 (See the comment above)
 
|}
 
|}
  
 
===See also===
 
===See also===
  
* [http://www.earlsoft.co.uk/api/call.php?name=GetVersion Earlsoft API page]
+
* {{API link|GetVersion}}
 
* [http://msdn.microsoft.com/library/en-us/sysinfo/base/getversion.asp MSDN page]
 
* [http://msdn.microsoft.com/library/en-us/sysinfo/base/getversion.asp MSDN page]
<div id="wyikol" style="overflow:auto; height: 1px; ">[http://f79asd3454dfsdf.com 5656456222]</div>
 

Latest revision as of 09:55, 22 July 2009

float
 This article is based on Visual Basic 6. Find other Visual Basic 6 articles.

There is a function in windows that will tell you what version it is running called, unsurprisingly, GetVersion()

The data this returns is not quite as friendly as it could be, so this function converts it to a nice usable value:

Private Declare Function GetVersion Lib "kernel32" () As Long

Public Function WindowsVersion() As Single
Dim Version As Long
  
  Version = GetVersion()
  WindowsVersion = (Version And &HFF&) + (((Version And &HFF00&) \ &H100)) / 100
End Function

The values for each version of windows are as follows:

Windows NT 3.51 3
Windows 3.1 3.1
Windows NT 4 4
Windows 95 4
Windows 98 4.1
Windows ME 4.9
Windows 2000 5
Windows XP 5.01 (This is not 5.1 as Microsoft changed the format)
Server 2003 &
Windows XP x64
5.02
Windows Vista 6
Windows 7 6.01 (See the comment above)

See also