Obtaining DLL-specific version information

topic: 

Most Windows Shell and common controls DLLs implement DllGetVersion function. It allows applications to obtain DLL-specific version information to make sure that required functionality in a DLL is implemented. The Windows API support class

is used to handle Windows API structures.

$SAMPLECODE$

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#DEFINE DLLVER_PLATFORM_WINDOWS  1
#DEFINE DLLVER_PLATFORM_NT       2

lcDll = "Shell32.dll"
DECLARE INTEGER DllGetVersion IN (lcDll) STRING @pdvi

LOCAL lcBuffer
lcBuffer = CHR(20) + REPLICATE(CHR(0), 19)
loWas = NEWOBJECT("WinApiSupport", "WinApiSupport.fxp")

IF DllGetVersion(@lcBuffer) = 0
	? "DLL:           " + lcDll
	? "Major version: " + TRANSFORM(loWas.Long2num(SUBSTR(lcBuffer, 5,4)))
	? "Minor version: " + TRANSFORM(loWas.Long2num(SUBSTR(lcBuffer, 9,4)))
	? "Build number:  " + TRANSFORM(loWas.Long2num(SUBSTR(lcBuffer, 13,4)))
	? "Platform:      " + IIF(loWas.Long2num(SUBSTR(lcBuffer, 17,4))=1,"Windows", "WinNT")
ENDIF


Comments