Paste this into a form with one command button:
Code: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 '1 = Windows 95. '2 = Windows NT szCSDVersion As String * 128 End Type Private Sub Command1_Click() Dim X As Long X = getVersion If X = 1 Then MsgBox "WIN95" If X = 2 Then MsgBox "WINNT" End Sub Public Function getVersion() As Long Dim osinfo As OSVERSIONINFO Dim retvalue As Integer osinfo.dwOSVersionInfoSize = 148 osinfo.szCSDVersion = Space$(128) retvalue = GetVersionExA(osinfo) getVersion = osinfo.dwPlatformId End Function




Reply With Quote