VB6 - 找不到 DLL

发布于 2024-10-20 15:18:13 字数 351 浏览 2 评论 0原文

我正在尝试使用命令

Private Declare Function myFuncLib "myDLL.dll" (ByVal file_name_in As String, _ ByVal file_name_out As String) As Long

但是当我运行程序时,它会弹出一个带有文本的框“:“运行时错误:53找不到:myDLL.dll”

DLL被放置在相同的位置 如果我将 myDLL.dll 放在 system32 文件夹

中,它可以工作,但我不想这样做,我想将 dll 放在项目的同一文件夹中,

有没有办法解决这个问题 ?

。有问题吗

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

痴情 2024-10-27 15:18:13

我的通灵能力预测您正在从 VB6 IDE 运行 - 因为构建的 EXE在应用程序目录(与 exe 相同的目录)中找到 DLL。

  • 当您从 VB6 IDE 运行时,它从应用程序目录中查找 DLL...但它认为应用程序目录是包含 VB6 IDE 本身的目录:(
  • 一种解决方法是更改​​当前在尝试使用 DLL 之前将工作目录设置为 VBP 目录,例如 Chdrive App.Path: Chdir App.Path (空中代码)
  • 编辑 以下来自 Beppe 的评论。您可以尝试的解决方法是,在您的开发计算机上,将 DLL 的副本放在安装 VB6 IDE 的同一目录中,可能是 C:\Program Files\Microsoft Visual Studio\VB98\ 您。可以将 DLL 与您构建的 EXE 放在用户计算机/生产计算机上。

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).

  • When you run from the VB6 IDE, it will find DLLs from the app directory... but it considers the app directory to be the directory containing the VB6 IDE itself :(
  • One workaround is to change the current working directory to be the VBP directory before you try to use the DLL. E.g. Chdrive App.Path: Chdir App.Path (air code)
  • EDIT Following comment from Beppe. Another workaround you could try is, just on your development machine, put a copy of the DLL in the same directory where the VB6 IDE is installed. Probably C:\Program Files\Microsoft Visual Studio\VB98\ You can put the DLL with your built EXE on the user machines / production machines.
半暖夏伤 2024-10-27 15:18:13

声明对Kernel32.lib SetDllDirectory函数的引用:

Private Declare Function SetDllDirectory Lib "Kernel32" Alias     "SetDllDirectoryA" (ByVal path As String) As Long

然后设置Dll目录如下:

SetDllDirectory App.path

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
得不到的就毁灭 2024-10-27 15:18:13

使用“Depends”解决

DLL 中存在未满足的依赖关系,但显然它在第一个 DLL 入口点返回错误。

谢谢大家

Solved using "Depends"

There was an unsatisfied dependency in the DLL, but obviously it was returning the error on the first DLL entry point.

Thank you all

童话 2024-10-27 15:18:13

正如 Beppe 在 他们的答案中所说,

Depends yourdll.dll

如果您看到其他 DLLS 带有 ?他们的名字旁边意味着他们失踪了。
通常它是 Microsoft C++ 调试 dll 之一,即 MSVCR120D.DLL

As Beppe said in their answer, use

Depends yourdll.dll

If you seel other DLLS with ? next to their name it means they are missing.
Usually it will be one of the Microsoft C++ Debug dll i.e MSVCR120D.DLL

寻找我们的幸福 2024-10-27 15:18:13

你需要先注册你的DLL..

Shell“regsvr32.exe /s”&路径

”是DLL的路径。如果DLL放在同一目录下,那么可以设置:

路径=应用程序路径& “/myDLL.dll”

You need to register your DLL first..

Shell "regsvr32.exe /s " & path

Where "path" is the path of the DLL.. If the DLL is placed in the same directory, then you can set:

path = App.path & "/myDLL.dll"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文