I'm trying to load a DLL in VB6 using the command
Private Declare Function myFuncLib "myDLL.dll" (ByVal file_name_in As String, _
ByVal file_name_out As String) As Long
But as soon as I run the program it pop-up a box with the text": "Run time error: 53 Cannot find: myDLL.dll"
The DLL is placed in the same directory of the project.
If I put myDLL.dll in the system32 folder it works, but I don't want to do it, I would like to place the dll in the same folder of the project.
Is there a way to solve this problem?
Thanks
My psychic powers predict you are running from the VB6 IDE - because a built EXE would find DLLs in the app directory (the same directory as the exe).
Chdrive App.Path: Chdir App.Path
(air code) C:\Program Files\Microsoft Visual Studio\VB98\
You can put the DLL with your built EXE on the user machines / production machines.Declare a reference to Kernel32.lib SetDllDirectory function:
Private Declare Function SetDllDirectory Lib "Kernel32" Alias "SetDllDirectoryA" (ByVal path As String) As Long
Then set the Dll directory as follows:
SetDllDirectory App.path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With