Reputation: 3304
I am using OSVERSIONINFO to check the OS in my vb6 application. But i am not able differentiate between windows 7 and windows server 2008 R2 because they have same version number,dwMajorVersion and dwMinorVersion. So how to differentiate between these. I think it can be done in vb.net using some other method. But how it can be done in vb6?
Upvotes: 2
Views: 6176
Reputation: 31
Right Click On Tool Bar > Components And Add > Microsoft SysControl 6.0. Double Click The SysInfo Button to Add on Form and use this code
Private Sub Form_Load()
Dim HancyRockz as string
HancyRockz = "OsVersion :- " & SysInfo1.OSVersion & " / Built " & SysInfo1.OSBuild
Text1.Text=HancyRockz
End Sub
Upvotes: 3
Reputation: 13357
As Xearinox noted in the above comment, OSVERSIONINFOEX
returns more information.
In particular, you can examine wProductType
to determine whether VER_NT_WORKSTATION
(0x0000001) is set or not. If it is, the machine is running a client OS, otherwise, server.
The chart in the remarks section of the OSVERSIONINFO MSDN entry even has a column which points out detecting the various OS's using that struct item.
Upvotes: 6