Page 1 of 1

Get the version of a Windows DLL

Posted: Mon May 03, 2004 5:47 pm
by MrCoder
Code updated for 5.20+

You can use this find the version of a Windows DLL.

Code: Select all

; Get the version of a Windows DLL.
; Made by Chris Way (03/05/2004)


dll.DllVersionInfo\cbSize = SizeOf(DllVersionInfo)
OpenLibrary(0,"Shell32.dll")   ; The DLL to get the version of
CallFunction(0,"DllGetVersion",@dll)

OpenConsole()

PrintN(Str(dll\dwMajorVersion))
PrintN(Str(dll\dwMinorVersion))
PrintN(Str(dll\dwBuildNumber))
PrintN(Str(dll\dwPlatformID))

Input()
CloseConsole()

See this MSDN page for more info.

I havent seen this around here so I hope it hasn't been posted before.
Hope its helpful.

Posted: Mon May 03, 2004 6:17 pm
by Karbon
But only if the DLL contains a function called "DllGetVersion" - right? I assum most (all?) of the MS ones do?

Posted: Mon May 03, 2004 6:30 pm
by MrCoder
Yeah, it says on MSDN that pretty much all of the MS ones do. Not sure how to add it too your own DLL's, I'll have a look.
From MSDN:
This function is not an application programming interface (API). It is exported by name from each DLL that implements it. Currently, most of the Windows Shell and common controls DLLs implement DllGetVersion. These include, but are not limited to, Shell32.dll, Comctl32.dll, Shdocvw.dll, and Shlwapi.dll.