VB Code:
'constants returned by OperatingSystem Global Const Windows95 As Integer = 95 Global Const Windows98 As Integer = 98 Global Const WindowsNT3 As Integer = 3 'v3.51 Global Const WindowsNT4 As Integer = 4 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 GetVersionExA Lib "kernel32" (lpVersionInformation As OSVersionInfo) As Integer Public Function OperatingSystem() As Integer 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 OperatingSystem = Windows95 ElseIf .dwMinorVersion = 10 Then OperatingSystem = Windows98 End If Case 2 If .dwMajorVersion = 3 Then OperatingSystem = WindowsNT3 ElseIf .dwMajorVersion = 4 Then OperatingSystem = WindowsNT4 End If Case Else OperatingSystem = 0 End Select End With End Function Private Sub Form_Load() If OperatingSystem = Windows98 Then Image1.Visible = True End Sub
How do you add Windows XP to that code?![]()




Reply With Quote