|
-
Mar 23rd, 2000, 07:14 AM
#1
Thread Starter
New Member
Hello everybody,
Could anyone please help me with a function that gives me the environment I am running (windows 95/98/2000 NT)?
Thanks in advance,
Marco.
-
Mar 23rd, 2000, 07:24 AM
#2
Hyperactive Member
There is a SystemInfo class in visual basic that can do this.
I think its called SYSTEMINFO.CLS but you will have to track it down yourself
-
Mar 23rd, 2000, 07:50 AM
#3
Hyperactive Member
Hi, Marco.
There is a control Microsoft SysInfo Control 6.0 in VB6. But I don't know constant for Windows 2000(this sample code is from VB Help):
Dim MsgEnd As String
Select Case SysInfo1.OSPlatform
Case 0
MsgEnd = "Unidentified"
Case 1
MsgEnd = "Windows 95, ver. " & CStr(SysInfo1.OSVersion)
Case 2
MsgEnd = "Windows NT, ver. " & CStr(SysInfo1.OSVersion)
End Select
MsgBox "System: " & MsgEnd
Larisa
-
Mar 23rd, 2000, 04:27 PM
#4
or u use api-calls 
here comes the code (agaaaaaaiiinnn...) =) (past it into a modul)
Code:
Private Type OSVERSIONINFO
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" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Public Function GetOSInfo() As String
Dim myVer As OSVERSIONINFO
Dim q As Long
myVer.dwOSVersionInfoSize = 148
q = GetVersionEx(myVer)
With myVer
Select Case myVer.dwPlatformId
Case 1
If .dwMinorVersion = 0 Then
GetOSInfo = "Windows 95"
ElseIf .dwMinorVersion = 10 Then
If .dwBuildNumber = 2222 Then
GetOSInfo = "Windows 98 SE"
Else '.dwBuildNumber = 1998
GetOSInfo = "Windows 98"
End If
End If
Case 2
If .dwMajorVersion = 3 Then
GetOSInfo = "Windows NT 3.51"
ElseIf .dwMajorVersion = 4 Then
GetOSInfo = "Windows NT 4"
ElseIf .dwMajorVersion = 5 Then
GetOSInfo = "Windows 2000"
End If
Case Else
GetOSInfo = "Windows 32 Bit System"
End Select
End With
GetOSInfo = GetOSInfo & "(Version = " & myVer.dwMajorVersion & "." & myVer.dwMinorVersion & " Build " & (myVer.dwBuildNumber And &HFFFF&) & ")"
End Function
you only need to call GetOSInfo and it will return a string with all necessary infos about the os.
hope that helps
taLON
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|