Private Declare Function GetVersion Lib "kernel32" () As Long
Public Function GetWinVersion() As String
Dim Ver As Long, WinVer As Long
Ver = GetVersion()
WinVer = Ver And &HFFFF&
'retrieve the windows version
GetWinVersion = Format((WinVer Mod 256) + ((WinVer \ 256) / 100), "Fixed")
End Function
Private Sub Form_Load()
'KPD-Team 1999
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
MsgBox "Windows version: " + GetWinVersion
End Sub
Alexander N. Samarin писал(а):На 3-х компьютерах протестировал, результаты таковы:
Win98SE = 4.10
Win2k pro = 5.00
WinXP pro = 5.01
А если существуют
Win 95
Win 98
Win 98 OSR 1
Win 98 OSR 2
Win NT 3
Win NT 4
Win ME
то какие у них будут версии?
Public Function getVersion() As Long
'Значения:
' 0-Error
' 1-Win 95
' 2-Win 98
' 3-Win Me
' 4-Win NT 3.51
' 5-Win NT 4.0
' 6-Win 2k
' 7-Win XP
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
Dim Res As Long
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
With osinfo
Select Case .dwPlatformId
Case 1
Select Case .dwMinorVersion
Case 0
Res = 1
Case 10
Res = 2
Case 90
Res = 3
End Select
Case 2
Select Case .dwMajorVersion
Case 3
Res = 4
Case 4
Res = 5
Case 5
If .dwMinorVersion = 0 Then
Res = 6
Else
Res = 7
End If
End Select
Case Else
Res = 0
End Select
End With
getVersion = Res
End Function
Сейчас этот форум просматривают: SemrushBot и гости: 149