Get Operating System Version
A few Lines of code to show you the version of windows you are running.
Original Author: venky_dude
Code
The Api used for this are Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long Private Type OSVERSIONINFO The GetVersion Api just takes one parameter of type OSVERSIONINFO. The Once Declared we can use this in the following way Dim os As OSVERSIONINFO This can be quite useful if you are making OS specific Applications. Send
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
OSVERSIONINFO structure will contain all the details about the OS after
GetVersionApi has been successfully executed. The parameters of
OSVERSIONINFO are
value is 3 for win Nt 3.51, 4 for win95/98/me and win nt4 and it is 5
for win2k.
for win 95,10 for win 98 ,98 for win ME,0 for win2k ,0 for win
nt4 and 51 for win nt 3.51
further differentiating the varios win OS.It is 1 for win 95/ 98/ME ,and 2
for win NT
os.dwOSVersionInfoSize = Len(os) 'Assign some
size to store the received information
Dim m As Long
Dim mv As Long
Dim pd As Long
Dim miv As Long
m = GetVersionEx(os) 'The
actual API call to GetVersionEx
mv = os.dwMajorVersion
pd = os.dwPlatformId
miv = os.dwMinorVersion
If pd = 2 Then MsgBox " OS is Windows NT" & mv & "." & miv
If pd = 1 Then
If miv = 10 Then MsgBox " OS is Windows 98 "
If miv = 0 Then MsgBox " OS is Windows 95 "
If miv = 90 Then MsgBox " OS is Windows ME "
End If
your comments to venky_dude@yahoo.com.
.Visit my homepage
for some cool VBcodes.
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.