Re: How to programmatically tell if a DLL is present?



briana <briana@xxxxxxx> wrote:
Somewhere, I remember seeing a program that would detect whether a DLL
was present through late binding and it would let the program continue
to run, but ignore the optional features.

This was in VB6, so it has dropped off the radar of most search
engines.

Anyone have some code that demonstrates this?

This is the routine I use:

Public Function CheckLibrary(ByVal ProgID As String) As Boolean
Dim obj As Object
' Used to insure we have a DLL (the engine).
On Error Resume Next
Set obj = CreateObject(ProgID)
CheckLibrary = Not (obj Is Nothing)
Err.Clear
End Function

Just pass it any creatable ProgID string ("library.object") from the library in
question.
--
..NET: It's About Trust!
http://vfred.mvps.org


.



Relevant Pages


Loading