VersionCommon



Option Explicit
Private Const S_OK = &H0
Private Declare Function LoadLibrary Lib "kernel32" _
Alias "LoadLibraryA" (ByVal lpLibFileName As String) _
As Long
Private Declare Function GetProcAddress Lib "kernel32" _
(ByVal hModule As Long, ByVal lpProcName As String) As _
Long
Private Declare Function FreeLibrary Lib "kernel32" ( _
ByVal hLibModule As Long) As Long
Private Declare Function DllGetVersion Lib "comctl32.dll" _
(pdvi As DLLVERSIONINFO) As Long
Private Type DLLVERSIONINFO
cbSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformID As Long
End Type
Public Function GetComCtlVersion(nMajor As Long, nMinor As _
Long) As Boolean
Dim hComCtl As Long
Dim hResult As Long
Dim pDllGetVersion As Long
Dim dvi As DLLVERSIONINFO
hComCtl = LoadLibrary("comctl32.dll")
If hComCtl <> 0 Then
hResult = S_OK
pDllGetVersion = GetProcAddress(hComCtl, _
"DllGetVersion")
If pDllGetVersion <> 0 Then
dvi.cbSize = Len(dvi)
hResult = DllGetVersion(dvi)
If hResult = S_OK Then
nMajor = dvi.dwMajorVersion
nMinor = dvi.dwMinorVersion
End If
End If
Call FreeLibrary(hComCtl)
GetComCtlVersion = True
End If
End Function


(versioncommon.html)- by Paolo Puglisi - Modifica del 25/3/2019