[AccessD] Windows version detection
Mark Simms
mar.ko at verizon.net
Sat Jun 15 09:32:01 CDT 2019
Thanks for that piece of code Gustav.
Mark Simms
marksimms at verizon.net
-----Original Message-----
From: Gustav Brock <gustav at cactus.dk>
To: Access Developers discussion and problem solving <accessd at databaseadvisors.com>
Sent: Sat, Jun 15, 2019 3:08 am
Subject: Re: [AccessD] Windows version detection
Hi Mark
I use the API - very straightforward.
>From the OsVersionInfo you can pull all info:
<vba>
Option Compare Database
Option Explicit
' Module to list the Windows version and to
' check if Windows is version 10 or higher.
' Constants for API and type declaration.
Private Const StatusSuccess As Long = 0
Private Const CsdVersionSize As Long = &H80
' Type declarations.
Private Type RtlOsVersionInfoW
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * CsdVersionSize
End Type
' API declarations.
Private Declare Function RtlGetVersion Lib "ntdll" (lpVersionInformation As RtlOsVersionInfoW) _
As Long
' Check if the hosting Windows OS is of version 10 or higher.
' Returns True if OS is version 10 or higher, False if it is not.
'
' 2018-12-07. Gustav Brock, Cactus Data ApS, Copenhagen
'
Public Function IsWindowsVersionMinimum10() As Boolean
Const Windows10MajorVersion As Long = 10
Dim OsVersionInfo As RtlOsVersionInfoW
Dim Minimum10 As Boolean
OsVersionInfo.dwOSVersionInfoSize = Len(OsVersionInfo)
If RtlGetVersion(OsVersionInfo) = StatusSuccess Then
' Version info is retrieved.
If OsVersionInfo.dwMajorVersion >= Windows10MajorVersion Then
Minimum10 = True
End If
End If
IsWindowsVersionMinimum10 = Minimum10
End Function
' Lists the hosting Windows OS information.
'
' 2018-12-07. Gustav Brock, Cactus Data ApS, Copenhagen
'
Public Sub ListWindowsVersion()
Dim OsVersionInfo As RtlOsVersionInfoW
OsVersionInfo.dwOSVersionInfoSize = Len(OsVersionInfo)
If RtlGetVersion(OsVersionInfo) = StatusSuccess Then
' Version info is retrieved.
Debug.Print "Major", OsVersionInfo.dwMajorVersion
Debug.Print "Minor", OsVersionInfo.dwMinorVersion
Debug.Print "Build", OsVersionInfo.dwBuildNumber
Debug.Print "Info", OsVersionInfo.dwOSVersionInfoSize
Debug.Print "Platform", OsVersionInfo.dwPlatformId
Debug.Print "CSDVersion", OsVersionInfo.szCSDVersion
End If
End Sub
</vba>
________________________________
Fra: AccessD <accessd-bounces at databaseadvisors.com> på vegne af Mark Simms via AccessD <accessd at databaseadvisors.com>
Sendt: 14. juni 2019 15:47
Til: accessd at databaseadvisors.com
Cc: Mark Simms
Emne: [AccessD] Windows version detection
I am still having issues with Windows 10 and my client's Access application.
What is the best way in VBA to determine the version of Windows that is running ? Environmental variable ?
Mark Simms
marksimms at verizon.net
--
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