什么可能导致 Vb6 运行时错误 430 [英] What could cause Vb6 run time error 430

查看:13
本文介绍了什么可能导致 Vb6 运行时错误 430的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用 vb6 编写的 COM dll.当我尝试从此 dll 创建类模块的新对象时,出现运行计时器错误 430:类不支持自动化或不支持预期的接口.有趣的是,这只发生在 IDE 外部,当我从 IDE 内部调试时,没有抛出错误,并且成功创建了类的新对象.可能是什么原因?

I have a COM dll written in vb6. When I try to create a new object of a class module from this dll I get a Run timer error 430: Class does not support automation or does not support expected interface. The interesting thing is that this happens only from outside the IDE, when I am debugging from within the IDE there is no error thrown and the new object of the class is created successfully. What can be the cause?

一般来说,我偶尔会在 COM dll 中遇到这类错误.调试 COM 问题的最佳方法是什么?程序运行时如何知道正在使用的dll的路径?

In general I occasionally get these kind of errors in COM dlls. What is the best way to debug COM issues? How can I know the path of the dll that is being used when a program is running?

推荐答案

如果这个项目完全是VB6.造成这种情况的可能原因是 EXE 在其目录中有 DLL 二进制文件的副本.当您触发它时,它会使用该副本而不是编译后的副本.当您添加 EXE 与旧 DLL 不兼容的方法或类时.如果您进行了错误修复或仅使用内部代码,则 EXE 将运行,但它使用旧的 DLL.

If this project is entirely in VB6. The likely cause of this is that the EXE has a copy of the DLL binary in it's directory. When you fire it uses that copy instead of the compiled copy. When you ADD methods or classes that EXE becomes incompatible with the old DLL. If you did a bug fix or just worked with the inside code then EXE will run but it used the old DLL.

将您的 DLL 设置为二进制兼容性.确保您有一个兼容目录.将最后一个版本的 DLL 放在那里.将二进制兼容性指向该 DLL.确保您的 EXE 编译到它的项目目录.从它的项目目录运行 EXE.这样,它将使用您编译的 DLL.您需要编写一个实用程序,以便您可以分别编译每个项目.使用 Virtual PC 或另一台计算机测试您的设置.

Set your DLL to Binary Compatibility. Make sure you have a Compatible directory. Put the DLL of the Last version in there. Point the Binary Compatibility to that DLL. Make sure your EXE compiles to it's project directory. Run the EXE from it's project directory. That way it will use the DLL that you compiled. You need to write a utility so that you can compile every project separately. Test your setup using Virtual PC or another computer.

所有这些步骤将有助于避免 DLL Hell.我自己的项目有两个 6 层的 ActiveX 项目.当我采用上述方法时,我的 DLL Hell 问题几乎消失了.

All these steps will help to avoid DLL Hell. My own project has two dozen ActiveX projects in 6 layers. When I adopted the above my DLL Hell problems dropped to almost nothing.

这篇关于什么可能导致 Vb6 运行时错误 430的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆