Maxell
asked on
Get Operating System version for AzraSound
AzraSound provided a nice code to get the operating system version!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yeah, it's the reference on the other code that you provided. I thought it was very nicely written and believed you deserved the credit.
Unfortunately, the other project isn’t complete. But at least it’s a great start. I think I will set that project aside and tackle it another time. It's a larger project than originally intended. Besides, I found some simpler projects to work on while researching the other one.
Thanks for your assistance, it was a tremendous help!!!
Cheers,
Maxell
Unfortunately, the other project isn’t complete. But at least it’s a great start. I think I will set that project aside and tackle it another time. It's a larger project than originally intended. Besides, I found some simpler projects to work on while researching the other one.
Thanks for your assistance, it was a tremendous help!!!
Cheers,
Maxell
ASKER
Just add a textbox to the form and upon form load you will get the OS version and type:
Private Type MYVERSION
lMajorVersion As Long
lMinorVersion As Long
lExtraInfo 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 ' Maintenance string for PSS usage
End Type
'// Windows Version constants
Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS
Private Const VER_PLATFORM_WIN32_NT = 2
'// Windows Version Declaration
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (ByRef lpVersionInformation As OSVERSIONINFO) As Long
'// Windows Version Function
Private Function WindowsVersion() As MYVERSION
Dim myOS As OSVERSIONINFO, WinVer As MYVERSION
Dim lResult As Long
myOS.dwOSVersionInfoSize = Len(myOS) 'should be 148
lResult = GetVersionEx(myOS)
'Fill user type with pertinent info
WinVer.lMajorVersion = myOS.dwMajorVersion
WinVer.lMinorVersion = myOS.dwMinorVersion
WinVer.lExtraInfo = myOS.dwPlatformId
WindowsVersion = WinVer
End Function
Private Sub Form_Load()
Dim myVer As MYVERSION
Dim strTmp As String
Dim vers As Long
myVer = WindowsVersion()
If myVer.lMajorVersion = 4 Then
If myVer.lExtraInfo = VER_PLATFORM_WIN32_NT Then
strTmp = "Windows NT version : "
ElseIf myVer.lExtraInfo = VER_PLATFORM_WIN32_WINDOWS
vers = myVer.lMinorVersion
If vers <= 10 Then
strTmp = "Windows 98 version : "
Else
strTmp = "Windows 95 version : "
End If
End If
Else
strTmp = "Windows version : "
End If
Text1.Text = strTmp & myVer.lMajorVersion & "." & myVer.lMinorVersion
End Sub