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 This fragment of code from the VB standard module shows the GetComCtlVersion function that retrieves the major and minor version numbers of the Comctl32.dll installed on the local system. Use this function when you subclass toolbar or listview controls from Comctl32.ocx and implement hot-tracking toolbar or full-row select in the listview. It's also useful when checking the DLL version in your setup application: VersionDistribution Platform 4.00Microsoft Windows 95/Windows NT 4.0 4.70Microsoft Internet Explorer 3.0x 4.71Microsoft Internet Explorer 4.00 4.72Microsoft Internet Explorer 4.01 |