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



On 24 Jan 2007 08:48:16 -0800, "briana" <briana@xxxxxxx> wrote:

I'm working on a program that has a few optional features. I'd like to
be able to let the program run, even when some optional DLLs are not
present.

Basically, I'd like to have a 'light' version of the program that will
still give the user the basic features without requiring them to
install any additional packages.

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.

Not sure if it's the best method but you could just error trap the first
attempt at creating an object from the DLL and set a flag for the rest
of your program to react to.

Rough and ready code;

Public DllFlag as Boolean

On Error Resume Next
Dim MyObject as DllObject
If Err = 0 Then
DllFlag = true
Endif
On Error GoTo 0
....
....
....
If DllFlag then
'Do DLL stuff
Else
'Do non-DLL stuff
Endif
--
Alfie [UK]
<http://www.delphia.co.uk/>
An expert is someone who takes a subject you understand and makes it sound confusing.

.