Click to See Complete Forum and Search --> : Declared DLL file not found??


mingwah
October 7th, 1999, 01:24 AM
Hi,

I have the following declarations in my Module file:


Declare Sub InstallMyHook Lib "HookKB" (byval hWnd as Long)
Declare Sub UnInstallMyHook Lib "HookKB" (byval hWnd as Long)



HookKB.dll is a little dll written by me in MS VC++, and is installed in the Windows\System directory.

On my own computer, everything runs smoothly.

But when my VB program is run on another computer, I get a "File not found HookKB" error, although the HookKB.dll is installed properly into the Windows\System directory.

I even tried changing Lib "HookKB" to Lib "HookKB.dll". But it still doesn't work.

Why does this happen? Why does it work on my computer and not on another?
How do I resolve this? Help help.

Rgds,
Ming_Wah

Lothar Haensler
October 7th, 1999, 02:04 AM
if your target machine is an NT machine you should place the dll into the system32 directory.
If that doesn't work, try to specify a complete path: declare sub... lib "C:\windows\system32\...dll" (just for testing, of course).

Peter Postlbauer
October 13th, 1999, 03:31 AM
I have the same problem as Mingwah has, and I installed my dll into the system32 direcory, I even specified a complete path, but it doesn't work either. It is confusing me, that it worked with VB 5, but it doesn't work with VB 6. Are there any files missing?
Regards Peter

Lothar Haensler
October 13th, 1999, 03:35 AM
Ok, then I'd try an explicit LoadLibrary(Ex) API call to explicitly load the DLL and see what the return code is (or what GetLastError (or err.LastDLLError) says). If you pass THAT to FormatMessage you should get a readable explanation of the reason for the failure.

You could also use the DEPENDS utility that comes with VS 6 to see what other components the offending DLL depends on.

Peter Postlbauer
October 13th, 1999, 04:33 AM
Unfortunatly this didn't solve my problem either, because the returncode of the LoadLibrary API is 126 - "Module not found", but the dll is there! It works on my computer (on which VB6 is installed) but it doesn't work on a different computer (without installed VB6)
Regards Peter

Lothar Haensler
October 13th, 1999, 05:14 AM
then try the DEPENDS utility...

Peter Postlbauer
October 13th, 1999, 07:41 AM
Yahoo! It was a useful track to the solution. The required dll was always in the correct directory, but my dll needs the PL/I-Runtime-Files, which are in a different directory (my dlls are written with PL/I). I just copied the runtime-files to the right directory - it works. Do you know where I can get the DEPENDS utility from , because I havn't got VS 6 (only VB 6)?

Lothar Haensler
October 13th, 1999, 07:46 AM
according to the docs it is supposed to be on the installation cd
\Common\Tools\VB\Unsupprt\Depend