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



"Alfie [UK]" <alfie@xxxxxxxxxxxx> wrote in message
news:av5fr255uh9qotsbqm340s02edrg6m5vs7@xxxxxxxxxx

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

Dim isn't enough to raise an error. You'll have to actually attempt to
create an instance of one of the classes the DLL exposes. Other than that,
error trapping is a perfect choice.

If anyone wants to "get fancy", my ComGuard add-in will create a class that
checks dependencies on everything your app requires to run (the first layer,
anyway)

http://www.vbsight.com/ComGuard.htm

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm


.



Relevant Pages

  • Re: How to programmatically tell if a DLL is present?
    ... attempt at creating an object from the DLL and set a flag for the rest ... Dim MyObject as DllObject ... create an instance of one of the classes the DLL exposes. ...
    (microsoft.public.vb.general.discussion)
  • Re: File Version without GetFileVersionInfo
    ... I think in NT+ OS you cannot rename a file if it's open without ... FILE_SHARE_DELETE flag. ... Mapped executables and DLLs are opened without it. ... How can you replace a currently-installed DLL? ...
    (microsoft.public.vc.mfc)
  • Re: and yet another Vista question
    ... Clicking properties on the dll under security, etc, shows it's valid under ... Set clsRes = CreateObject ... but it seems to me your own error handler would have shown a "no resource" ... your error trap would prevent VB from reporting the ...
    (microsoft.public.vb.general.discussion)
  • Re: Write-once with DLL shared memory
    ... > that there was no Shared section in my Release version of the DLL. ... > launching the Debug version, I was launching the Release version, which ... > destination process did see the flag being set, ... -Software Consultant (Embedded systems and Real Time Controls) ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Register filter built with Visual Studio 2005
    ... In both the dll and the SourceFilter I am using the /MT flag. ... but that gives me linker errors due to unresolved externals in ...
    (microsoft.public.win32.programmer.directx.video)