Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win9x / WinNT

Status
Not open for further replies.

speek

Technical User
Mar 29, 2008
25
US
Short question:
How to determine automatically (without user input) if the OS is Win9x or WinNT?
 
here is some code from vbapi.com:

Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type

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
Debug.Print "Windows version number:"; os.dwMajorVersion; "."; os.dwMinorVersion


Hope this gets you on the right track!
Josh
 
Thanx Josh!

Maybe I can use this, but I would rather just know if it's Windows9x or WinNT. So only two possibilities. Anbody has code for that?
 
Hi speek,

Use a SysInfo control

MyVar = SysInfo1.OSPlatform
' where 0 = unknown, 1 = win95/98, 2 = nt

Jon
 
Thanx Jon4747, that's exactly what I need. Is a Sysinfo control included in standard VB6 or can I find it somewhere on the net?
 
Found it. Works fine :) Thanx for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top