RozliÜenφ typ∙ Windows

Postup:
V deklaraΦnφ Φßsti formulß°e zapiÜte:

Private Declare Function GetVersionExA Lib "kernel32" _
   (lpVersionInformation As OSVERSIONINFO) As Integer

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 Function getVersion() As String

   Dim osinfo As OSVERSIONINFO
   Dim retvalue As Integer

   osinfo.dwOSVersionInfoSize = 148
   osinfo.szCSDVersion = Space$(128)
   retvalue = GetVersionExA(osinfo)

   With osinfo
      Select Case .dwPlatformId
         Case 1
            If .dwMinorVersion = 0 Then
               getVersion = "Windows 95"
            ElseIf .dwMinorVersion = 10 Then
               getVersion = "Windows 98"
            End If
         Case 2
            If .dwMajorVersion = 3 Then
               getVersion = "Windows NT 3.51"
            ElseIf .dwMajorVersion = 4 Then
               getVersion = "Windows NT 4.0"
            ElseIf .dwMajorVersion = 5 Then
               getVersion = "Windows 2000"
            End If
         Case Else
            getVersion = "Chyba"
      End Select
   End With

End Function

Na formulß° p°idejte tlaΦφtko. Na udßlost Click tlaΦφtka:

Private Sub Command1_Click()

   MsgBox getVersion()

End Sub
   

Zp∞t

Autor: The Bozena