What is the constant used in case the operating system is Windows Me? I am using GetVersionEx API call with OSVERSIONINFO data structure.
Amitabh
Printable View
What is the constant used in case the operating system is Windows Me? I am using GetVersionEx API call with OSVERSIONINFO data structure.
Amitabh
Windows 3.x = 0
Windows 95/98/ME = 1
Windows NT = 2
What about Windows 2000? Same as NT! Also, how do I differentiate between 95/98/Me?
Yes, 2000 is the same as NT. I'm not sure if you can differenciate between group into the specific OS.
Is there any way we can get the major and minor build numbers of the operating system in Win98/95? If it is possible, then we can possibly parse and check the value against a database. Win2000 supports a API called VerifyVersionInfo which seems to able to provide all the build numbers,version and service pack installed.
You can differentiate between different versions of windows
by querying the registry.
for 95/98/ME
HKLM\Software\Windows\CurrentVersion ProductName =
for NT/2k
HKLM\Software\Windows NT\CurrentVersion ProductName =
Add this to a Form with a CommandButton.
Code:Private Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Function GetDiskFreeSpaceEx Lib "kernel32.dll" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As ULARGE_INTEGER, lpTotalNumberOfBytes As ULARGE_INTEGER, lpTotalNumberOfFreeBytes As ULARGE_INTEGER) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Type ULARGE_INTEGER
LowPart As Long
HighPart As Long
End Type
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Dim OsInfo As OSVERSIONINFO
Dim tmp As String
Dim FreeUser As ULARGE_INTEGER
Dim Total As ULARGE_INTEGER
Dim FreeSys As ULARGE_INTEGER
Dim Temp As Currency
Dim fTemp As Currency
Private Sub Command1_Click()
'Get OS Info
OsInfo.dwOSVersionInfoSize = Len(OsInfo)
retval = GetVersionEx(OsInfo)
Select Case OsInfo.dwPlatformId
Case 0
tmp = "Windows 3.x"
Case 1
tmp = "Windows 95/98"
Case 2
tmp = "Windows NT"
End Select
Print "Version: " & OsInfo.dwMajorVersion & "." & OsInfo.dwMinorVersion
Print "Build: " & OsInfo.dwBuildNumber
Print "Platform: " & tmp
'Get DiskSpace
GetDiskFreeSpaceEx "C:\", FreeUser, Total, FreeSys
CopyMemory Temp, Total, 8
CopyMemory fTemp, FreeUser, 8
Print "Total Space: " & (CCur(Temp) * 10000) / 1000000000 & " GB"
Print "Free Space: " & (CCur(fTemp) * 10000) / 1000000000 & " GB"
End Sub
Is Windows Me same as Win95/98. Also what is the Minor Number that I will get in case of Win Me?
Thanks for the help.