I am using the following code to try to determine the version of Windows a user of my application has. I am trying it out on my computer that is running Windows 7 64 bit and the code says that I am running Major Version 5 and Minor Version 1. (Windows Vista is 6.1, so I am assuming that Windows 7 must be Major Version 6.2) This would indicate that I am running Windows XP, but I am running Windows 7. What am I doing wrong? I have written my program using Access 2002. But that should not have anything to do with the code determining the version of windows that I an running. Right? Any help with the code would be greatly appreciated.
'FUNCTION TO DETERMINE WINDOWS VERSION NUMBER
Option Compare Database
Option Explicit
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Integer
Public Function getVersion() As String
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
getVersion = "Version is " & osinfo.dwMajorVersion & "." & osinfo.dwMinorVersion
End Function