Results 1 to 2 of 2

Thread: Detect Opperating System

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Denver
    Posts
    265

    Question

    Is there a way to detect what opperating system is running on the machine your app is installed on? I've got a small program that needs to use certain unique registry keys in WinNT or Win98/95 depending on which version of the OS is present.

    ~A6

  2. #2
    Fanatic Member crispin's Avatar
    Join Date
    Aug 2000
    Location
    2 clicks west of a Quirkafleeg...Cornwall, England
    Posts
    754
    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
    Crispin
    VB6 ENT SP5
    VB.NET
    W2K ADV SVR SP3
    WWW.BLOCKSOFT.CO.UK

    [Microsoft Basic: 1976-2001, RIP]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width