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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I load a dll in Visual Basic

Status
Not open for further replies.

SkiLift

Programmer
Dec 18, 2003
47
US
When running a program in Visual Basic 6.0, it says it can not load a dll. How do I tell it where and how to load the dll?
 
There are many possible reasons for this message.
If you have declared a function call into an external DLL, such as a C DLL, or for a Windows API call, then it may fail if the DLL does not exist in the system PATH, or in the same folder as your app.

It will fail if the DLL is correctly found, but the DLL relies upon other files to work. Under those circumstances, the initialisation routine of the DLL will fail, and it will shut down with an error code of 0, telling VB that it failed to load.


Do you know which DLL is the problem?
Are you calling one directly, or is it likely that an OCX in your project is trying to use one?
 
Thanks for your help. I am new to this and I only had time to investigate this a little further. It is a C dll. I believe VB finds and loads x1.dll and x1.dll tries to load x2.dll. The x2.dll is the one it cant load. I'm still not sure if an OCX is involved, but it does not look like it so far.
 
Hi
You should have registered all .dll's you need: x1.dll (used by Vb) and x2.dll (used by x1.dll)

Register x2.dll: "regsvr32 x2.dll"

Good luck!
;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top