I am looking through the search to find out how to detemine the OS.
Basically all I need to do is determine if its win 2000 do something. If win xp do something. I am only going to be installing this program on 2000 or xp only.
Rob
Printable View
I am looking through the search to find out how to detemine the OS.
Basically all I need to do is determine if its win 2000 do something. If win xp do something. I am only going to be installing this program on 2000 or xp only.
Rob
VB Code:
Option Explicit Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformID As Long szCSDVersion As String * 128 'Maintenance string for PSS usage End Type Private Declare Function GetVersionEx Lib "kernel32" _ Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Private Const VER_PLATFORM_WIN32_NT = 2 Private Const VER_PLATFORM_WIN32_WINDOWS = 1 Function GetVersion() As String Dim os As OSVERSIONINFO os.dwOSVersionInfoSize = Len(os) GetVersion = "N/A" If GetVersionEx(os) Then 'VER_PLATFORM_WIN32s ' Win32s on Windows 3.1. 'VER_PLATFORM_WIN32_WINDOWS ' Windows 95 ' Windows 98 ' Windows Me. 'VER_PLATFORM_WIN32_NT ' Windows NT 3.51 ' Windows NT 4.0 ' Windows 2000 ' Windows XP ' Windows .NET Server If os.dwPlatformID = VER_PLATFORM_WIN32_NT Then ' Windows NT 3.51 3 ' Windows NT 4.0 4 ' Windows 2000 5 ' Windows XP 5 ' Windows .NET Server 5 If os.dwMajorVersion = 3 Then GetVersion = "Microsoft Windows NT 3.51" ElseIf os.dwMajorVersion = 4 Then GetVersion = "Microsoft Windows NT 4" ElseIf os.dwMajorVersion = 5 Then ' Windows NT 3.51 51 ' Windows NT 4.0 0 ' Windows 2000 0 ' Windows XP 1 ' Windows .NET Server 2 Select Case os.dwMinorVersion Case 0 GetVersion = "Microsoft Windows 2000" Case 1 GetVersion = "Microsoft Windows XP" Case 2 GetVersion = "Microsoft Windows .NET Server" End Select End If ElseIf os.dwPlatformID = VER_PLATFORM_WIN32_WINDOWS Then ' Windows 95 4 ' Windows 98 4 ' Windows Me 4 GetVersion = "Windows 95/98" If os.dwMajorVersion = 4 Then ' Windows 95 0 ' Windows 98 10 ' Windows Me 90 Select Case os.dwMinorVersion Case 0 GetVersion = "Microsoft Windows 95" Case 10 GetVersion = "Microsoft Windows 98" Case 90 GetVersion = "Microsoft Windows Me" End Select End If End If Else GetVersion = "N/A" End If End Function Private Sub Form_Load() Debug.Print GetVersion End Sub
VB Code:
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type
I am working on the code will let ui know what happens
yes this worked fine. My question is did you write this code or did u just figure it out. I am just curious to know.
Rob
I've downloaded it from one or more sites.Quote:
Originally posted by PartyInaCan
yes this worked fine. My question is did you write this code or did u just figure it out. I am just curious to know.
Rob