VBA Excel 找不到 DLL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19590614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VBA Excel Cannot find DLL
提问by Talls
I am currently trying to add control to a Power Analyzer in an excel tool. The company provides USB drivers and the appropriate modules and DLLs. I added the DLLs to the System32 folder to ensure they were read in the path. After importing the modules and trying to run the program, I get the error "File Not Found". I then tried to hard code the location of the DLL and I received the same error.
我目前正在尝试在 Excel 工具中向 Power Analyzer 添加控件。该公司提供 USB 驱动程序以及相应的模块和 DLL。我将 DLL 添加到 System32 文件夹以确保它们在路径中被读取。导入模块并尝试运行程序后,出现错误“找不到文件”。然后我尝试对 DLL 的位置进行硬编码,但收到了同样的错误。
I've looked around the internet and the only issue I could find was possibly a dependency missing from the DLL. An example of the line I'm trying to use is:
我环顾了互联网,发现的唯一问题可能是 DLL 中缺少依赖项。我尝试使用的行的一个例子是:
Declare Function TmSend Lib "tmctl.dll" (ByVal id As Long, ByVal msg As String) As Long
This line is apart of the module provided by the manufacturer. Is there something I'm missing to get this to work? I want to make sure before I contact the manufacturer.
这条线是制造商提供的模块的一部分。有什么我想让它工作的吗?我想在联系制造商之前确定一下。
EDIT:
编辑:
It appears that the manufacturer uploaded a corrupt DLL causing the issue to arise. When checking the file with Dependency Walker, it failed to even read the DLL.
似乎制造商上传了一个损坏的 DLL,导致问题出现。使用 Dependency Walker 检查文件时,它甚至无法读取 DLL。
回答by Bathsheba
I see from your question that you've tried all the normal things (making sure the dll is on your path &c.)
我从你的问题中看到你已经尝试了所有正常的事情(确保 dll 在你的路径上&c。)
You now need to examine the dll carefully. Download this: http://www.dependencywalker.com/
您现在需要仔细检查 dll。下载这个:http: //www.dependencywalker.com/
Then use it to open your dll. All the missing dependent dlls will be clearly displayed. Put those on your path too and you're done.
然后用它打开你的dll。所有丢失的依赖 dll 都将清楚地显示出来。把这些也放在你的路上,你就完成了。
(To clear up some confusion: you will not need to register this dll or add a reference to it.)
(澄清一些混淆:您不需要注册这个 dll 或添加对它的引用。)