Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Visual Basic
Expertise: Advanced
Jan 13, 1999



Application Security Testing: An Integral Part of DevOps

Yeah, But Which Common Controls?

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.00	Microsoft Windows 95/Windows NT 4.0 
4.70	Microsoft Internet Explorer 3.0x 
4.71	Microsoft Internet Explorer 4.00 
4.72	Microsoft Internet Explorer 4.01 

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 _
Private Declare Function FreeLibrary Lib "kernel32" ( _ 
	ByVal hLibModule As Long) As Long 
Private Declare Function DllGetVersion Lib "comctl32.dll" _
	(pdvi As DLLVERSIONINFO) As Long 

	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 

	hComCtl = LoadLibrary("comctl32.dll") 
	If hComCtl <> 0 Then 
	hResult = S_OK 
	pDllGetVersion = GetProcAddress(hComCtl, _
		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
Lubomir Bruha
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date