[AccessD] A2K:Determine OS and version via VBA - Solved thanksGustav and Stuart

Erwin Craps - IT Helps Erwin.Craps at ithelps.be
Wed Sep 1 01:14:44 CDT 2004


It is advised to put the MDE on the local computer of the client, so all
network users use their own MDE file.

Thats always good for several reasons already discusses in the mailing
list, but I want to point out that there are some weirder things with
Access 2003 references than we are used with 2K.

References some times need to be disabled and re-enabled before the
apllications works.
In case you have different Access versions running in the same site, a
MDE file on the user local computer is a must due to these references.

Erwin


 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Darren DICK
Sent: Wednesday, September 01, 2004 5:25 AM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] A2K:Determine OS and version via VBA - Solved
thanksGustav and Stuart

Gustav and Stuart

Many thanks to you both 

Both sets of code Work like a charm

Many thanks to you both

Have a great day

Darren



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, 31 August 2004 9:57 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2K:Determine OS and version via VBA


Hi Darren

> I used to have a little code jewel from the list tucked away in my own

> personal little archive that would allow me to determine the OS in
> VBA- But alas since the death of the laptop my personal stash has gone

> So....Anyone got any code to determine the OS and version?

We use this module:

<code>

Option Compare Database
Option Explicit

'                           Major     Minor
' OS              Platform  Version   Version  Build
'
' Windows 95      1         4          0
' Windows 98      1         4         10       1998
' Windows 98SE    1         4         10       2222
' Windows ME      1         4         90       3000
' NT 3.51         2         3         51
' NT              2         4          0       1381
' 2000            2         5          0
' XP              2         5          1       2600
' Server 2003     2         5          2

' Code based on MS API documentation.
' 2004-07-02. Assembled by Cactus Data ApS, CPH.
  
  Private Const VER_PLATFORM_WIN32s         As Long = 0 ' Win32s on
Windows
3.1x.
  Private Const VER_PLATFORM_WIN32_WINDOWS  As Long = 1 ' Windows 95,
Windows 98, Windows ME.
  Private Const VER_PLATFORM_WIN32_NT       As Long = 2 ' Windows NT,
Windows 2000, Windows XP, Windows Server 2003.
  
  Private Const clngCSDVersion              As Long = 128

  Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion      As Long
    dwMinorVersion      As Long
    dwBuildNumber       As Long
    dwPlatformId        As Long
    szCSDVersion        As String * clngCSDVersion
  End Type
  
  Private Declare Function GetVersionEx Lib "kernel32" Alias
"GetVersionExA"
( _
    ByRef lpVersionInformation As OSVERSIONINFO) _
    As Long

Public Function GetVersion() As String

' Retrieves version of current Windows OS.
' Returns version as full string.
'
' 2004-07-02. Cactus Data ApS, CPH.

  Dim OSV         As OSVERSIONINFO
  
  Dim strVersion  As String
    
  OSV.dwOSVersionInfoSize = Len(OSV)
  OSV.szCSDVersion = Space$(clngCSDVersion)
  GetVersionEx OSV
  With OSV
    ' Service Pack info string.
    Debug.Print .szCSDVersion
    Select Case .dwPlatformId
      Case VER_PLATFORM_WIN32s          ' Win32s on Windows 3.1x.
        strVersion = "Windows 3.1"
      Case VER_PLATFORM_WIN32_WINDOWS   ' Windows 95, Windows 98,
        Select Case .dwMinorVersion     ' Windows ME.
          Case 0
            strVersion = "Windows 95"
          Case 10
            If (.dwBuildNumber And &HFFFF&) = 2222 Then
              strVersion = "Windows 98SE"
            Else
              strVersion = "Windows 98"
            End If
          Case 90
            strVersion = "Windows ME"
        End Select
      Case VER_PLATFORM_WIN32_NT        ' Windows NT, Windows 2000,
Windows
XP,
        Select Case .dwMajorVersion     ' Windows Server 2003.
          Case 3
            strVersion = "Windows NT 3.51"
          Case 4
            strVersion = "Windows NT 4.0"
          Case 5
            Select Case .dwMinorVersion
              Case 0
                strVersion = "Windows 2000"
              Case 1
                strVersion = "Windows XP"
              Case 2
                strVersion = "Windows Server 2003"
            End Select
        End Select
      Case Else
        strVersion = "Unknown"
    End Select
  End With
  
  GetVersion = strVersion
  
End Function

Public Function IsWinXP() As Boolean

' Checks current Windows OS.
' Returns True if OS is Win XP or Server 2003.
'
' 2004-07-07. Cactus Data ApS, CPH.

  Dim OSV         As OSVERSIONINFO
  
  Dim booVersion  As Boolean
    
  OSV.dwOSVersionInfoSize = Len(OSV)
  GetVersionEx OSV
  With OSV
    Select Case .dwPlatformId
      Case VER_PLATFORM_WIN32_NT        ' Windows NT, Windows 2000,
Windows
XP,
        Select Case .dwMajorVersion     ' Windows Server 2003.
          Case 5
            Select Case .dwMinorVersion
              Case 0
                ' strVersion = "Windows 2000"
              Case 1
                ' strVersion = "Windows XP"
                booVersion = True
              Case 2
                ' strVersion = "Windows Server 2003"
                booVersion = True
            End Select
        End Select
    End Select
  End With
  
  IsWinXP = booVersion
  
End Function

</code>

Have fun!

/gustav

--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list