Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting if a DLL is not present

Status
Not open for further replies.

SmileeTiger

Programmer
Mar 13, 2000
200
US
I want my VB application to fail if a particular dll is not present in the system directory. Any ideas on how to do it?


Smilee
 
You have a few options.. I'm not sure exactly what you're trying to accomplish, but here's a couple ideas to get you started.

You could just do a Dir() for that filename in the appropriate folder, which will tell you if it exists or not. However this doesn't help you if someone moves it, or copies a different file into there with the same name, etc. The other option would be turn on error handling (On Error Resume Next, etc.) and then try to create the object, call the function or somehow use the DLL. You could then check the error code to know if the DLL existed and was valid.
 
Basically I have a DLL that I made and I am trying to find out if it is there when I start the program using it. I suppose I could have a function that returns a version number or something... Is there another way to do this?


Smilee
 
If it's a COM object you can just create it (it'll either work or it won't), if it's a regular DLL that you're using Declare Function.... to access it, then you should be able to just try whatever is the quickest function within the DLL upon application startup. If it doesn't exist (or is invalid) this call will fail, either way, you're just trying to trap an error upon application startup and gracefully exit letting the user know that they need to install the DLL.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top