VB6 错误 - 无法加载 .ocx 文件

发布于 2024-07-26 19:29:53 字数 196 浏览 9 评论 0原文

今天大部分时间我都在尝试将 OCX 文件加载到我的一个 VB6 项目中。 我已尝试尽我所能检查注册表中的 COM 注册,并多次尝试在该文件上使用 REGSVR32 但无济于事。 当我尝试加载组件(在项目 --> 组件下)时,我从 VB6 得到的只是“FilePath\FileName.ocx”无法加载。 有其他人以前见过这个吗?如果是的话,有什么想法如何解决它吗?

I have been trying to load a OCX file into one of my VB6 projects for most of the day today. I've tried checking the COM registration in the registry the best that I know how, and have attempted several times using REGSVR32 on the file to no avail. All I keep getting from VB6 when I try to load the component (Under Project --> Components) is 'FilePath\FileName.ocx' could not be loaded. Has anyone else seen this before, and if so, any ideas how to fix it?

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

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

发布评论

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

评论(8

泅人 2024-08-02 19:29:53

只需几个提示即可帮助隔离问题....

使用 OleView 查看控件

检查名称:如果它是保留字之一,例如“Menu”,vb6 将无法加载它。 (尽管 vb6 会很乐意让您创建(和使用)一个名称不好的名称,直到保存并重新加载为止)

检查接口:它是否描述了功能? 您的 ocx 可能已损坏或未经许可。

尝试使用 ActiveX 控件测试容器加载它...
如果可以的话,问题出在 VB6 而不是 ocx。

Just a couple of tips to help isolate the problem....

Look at the control with OleView

Examine the name: if it is one of the reserved words such as 'Menu', vb6 will fail to load it. (Although vb6 will happily let you create (and use) one with a bad name until it is saved and reloaded)

Examine the interface: does it describe the functionality? You may have a damaged or unlicensed ocx.

Attempt to load it with the ActiveX Control Test Container...
If you can, the problem is with VB6 and not the ocx.

哭了丶谁疼 2024-08-02 19:29:53

这可能是一个依赖性问题——OCX 所需的其他一些组件不存在。 Dependency Walker 将找到任何静态依赖项。

This it may be a dependency issue -- some other component needed by the OCX is not present. Dependency Walker will find any static dependencies.

長街聽風 2024-08-02 19:29:53

我们最近修复了类似的错误。 在我们的例子中,错误出现在 Visual Basic 项目 (.vbp) 文件中。 项目文件已在标准化构建机器之外进行编辑,并包含对 OCX 组件的引用 - 包括工作站特定路径和路径。 组件的版本。

您可以在文本编辑器中编辑项目文件,也可以从版本控制中获取工作版本。

We fixed similar error recently. In our case the error was in the Visual Basic project (.vbp) file. Project file had been edited outside standardized build machine and contained references to OCX components - including workstation specific paths & versions of the components.

You can either edit the the project file in text editor or get a working version from version control.

心奴独伤 2024-08-02 19:29:53

取消注册并再次注册也对我有用。
请注意,您需要使用以下语法注册该组件:

regsvr32 /i:design olch2x8.ocx

Un-registering and registering again worked for me too.
Please note that you need to register this component using this syntax:

regsvr32 /i:design olch2x8.ocx
烟火散人牵绊 2024-08-02 19:29:53

当您说您已在文件上使用“REGSVR32 无济于事”时,您的意思是您收到文件名成功消息,还是错误消息? 如果注册文件成功,则 CMB 可能认为 ocx 未获得许可是正确的。

When you say you have used "REGSVR32 on the file to no avail" do you mean that you get a file name succeeded message, or an error message? If registering the file succeeds CMB is likely right about the ocx being unlicensed.

可爱暴击 2024-08-02 19:29:53

除了许可之外,vb6 还有一些其他的问题。 特别如果 OCX 是用 VB6 开发的。

如果是这样,“正式”系统注册版本可能与您正在使用的特定 ocx 冲突。 换句话说,它们可能具有相同的专有名称(或 classid),但您尝试使用的名称可能无法实现系统注册名称中描述的所有功能(即,您拥有进化程度较低的版本)。 当作者希望在增强控件功能的同时保持二进制兼容性时,就会出现这种情况。 只要公共接口保持兼容,vb就不会重新计算classid。

您可以通过强制注销特定控件(实际上注销该控件的所有实例)来解决此问题。 (regsvr32 /u control.ocx ) 然后重新注册您想要使用的那个。 确保执行此操作时不存在正在运行的 VB6 实例,否则结果可能不起作用。 (检查您的任务列表)

希望有帮助...

Licensing aside, there are a couple of other trip points with vb6. Especially if the OCX was developed in VB6.

If so, the 'officially' system registered version may conflict with the specific ocx you're using. In other words, both of them might have the same proper name (or classid) but the one you're attempting to use may not implement all the functionality described in the system registered one (i.e. you have a less evolved version). This arises when the author desires to maintain binary compatibility while enhancing the functionality of a control. As long as the public interfaces remain compatible, vb will not recalculate the classid.

You can fix this by forcibly unregistering the specific control (actually unregister all instances of the control). (regsvr32 /u control.ocx ) Then re-register the one you intend to use. Be certain that no running instance of VB6 exists when you do this or the results might not work. (Check your task list)

Hope that helps...

一瞬间的火花 2024-08-02 19:29:53

该控件可能依赖于另一个可能丢失或未注册的 DLL 或 OCX,并且这可能表现为 VB 报告您尝试使用的控件丢失。 但是,我不确定您如何识别依赖关系。 据我所知,dependency walker 识别静态依赖关系; 我不确定它是否可以识别 COM 依赖项。

The control may be reliant on another DLL or OCX that may be missing or not registered and this could manifest itself as VB reporting that the control you're trying to use is missing. However, I'm not sure how you would identify the dependencies. As far as I know, dependency walker identifies static dependencies; I'm not sure if it can identify COM dependencies.

生来就爱笑 2024-08-02 19:29:53

取消注册 Ocx
重新注册ocx
然后在VB6中再次加载该项目,它对我有用。

感谢大家

Un register the Ocx
re register the ocx
then loaded the project again in VB6, it worked for me.

Thanks everyone

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