VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get details about your OS using GetVersionEx API

by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 17th January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get details about your OS using GetVersionEx API

API Declarations


dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long


Rate Get details about your OS using GetVersionEx API



Dim os As OSVERSIONINFO  ' receives version information 
Dim retval As Long  ' return value 
os.dwOSVersionInfoSize = Len(os)  ' set the size of the structure 
retval = GetVersionEx(os)  ' read Windows's version information 
MsgBox "Windows version number:" & os.dwMajorVersion & Chr(Asc(".")) & os.dwMinorVersion 
MsgBox "OS Version Info Size = " & os.dwOSVersionInfoSize 
MsgBox "BuildNumber = " & os.dwBuildNumber 
MsgBox "Platform ID = " & os.dwPlatformId 'Note If ID =0 win 3.x , ID=1 win9x and ID =2 WINNT 
MsgBox "CSD Version = " & os.szCSDVersion 
End 
End Sub

Download this snippet    Add to My Saved Code

Get details about your OS using GetVersionEx API Comments

No comments have been posted about Get details about your OS using GetVersionEx API. Why not be the first to post a comment about Get details about your OS using GetVersionEx API.

Post your comment

Subject:
Message:
0/1000 characters