Dll Not Found in IDE
Date: 12.31.10 - 4:35pm
If you are getting the error DLL not found when using a standard C Dll or maybe if a dependancy of the dll is not being found either in the IDE or at runtime, you can do a manual LoadLibrary() call and it will fix it.
This error can also be caused by the dll failing to load. You can test this by if LoadLibrary(explicitpath.dll) = 0. This happened to me tonight and cost me many many hours debugging. A popular version of zlib was failing to load on versions of windows prior to XPSP2 because it tried to import kernel32.DecodePointer. Ouch. VB6 IDE really sucks when it comes to loading declares
If you are working on the C dll, also make sure to store the handle returned by the LoadLibrary call and issue a FreeLibrary(hLib) in termination. If you dont, the IDE will hang onto the dll itself, and you will have to close the IDE to recompile the C dll.
It appears this problem stems from a bug in VB6 IDE where it doesnt always set the applications current working directory properly on launch. Maybe I was launching the project from a shortcut or something when I was having this problem mostly. Also when you create a new project and start working on it after saving it to a directory it doesnt reset. Another solution to this problem is to issue a chdir app.path in the form load to explicitly set the working directory in case the vb6 is using something else.