home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap22 / getver.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-24  |  1.5 KB  |  45 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   8460
  5.    ClientLeft      =   3555
  6.    ClientTop       =   2460
  7.    ClientWidth     =   6690
  8.    Height          =   8865
  9.    Left            =   3495
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8460
  12.    ScaleWidth      =   6690
  13.    Top             =   2115
  14.    Width           =   6810
  15. Attribute VB_Name = "Form1"
  16. Attribute VB_Creatable = False
  17. Attribute VB_Exposed = False
  18. Option Explicit
  19. Private Type OSVERSIONINFO
  20.         dwOSVersionInfoSize As Long
  21.         dwMajorVersion As Long
  22.         dwMinorVersion As Long
  23.         dwBuildNumber As Long
  24.         dwPlatformId As Long
  25.         szCSDVersion As String * 128
  26. End Type
  27. '  dwPlatformId defines:
  28. Private Const VER_PLATFORM_WIN32s = 0
  29. Private Const VER_PLATFORM_WIN32_WINDOWS = 1
  30. Private Const VER_PLATFORM_WIN32_NT = 2
  31. Private Declare Function GetVersionEx Lib "kernel32" _
  32.     Alias "GetVersionExA" _
  33.     (lpVersionInformation As OSVERSIONINFO) As Long
  34. Private Sub Form_Load()
  35.     Dim v As OSVERSIONINFO
  36.     v.dwOSVersionInfoSize = Len(v)
  37.     GetVersionEx v
  38.     MsgBox "Major Version = " & v.dwMajorVersion
  39.     MsgBox "Minor Version = " & v.dwMinorVersion
  40.     MsgBox "Build Number = " & v.dwBuildNumber
  41.     If v.dwPlatformId = VER_PLATFORM_WIN32s Then MsgBox "Win32s"
  42.     If v.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then MsgBox "Windows"
  43.     If v.dwPlatformId = VER_PLATFORM_WIN32_NT Then MsgBox "Windows NT"
  44. End Sub
  45.