How to fix broken references in VB6

烂漫一生 提交于 2020-05-15 08:17:30

问题


I have a VB6 project that I was actively developing on one machine and have had to move the VB6 project over to a different machine running hardware that my program will be talking to. After moving the project, I am getting file not found for comctl32.ocx. The error message includes the path to the file and I've verified that the path is correct and that the file actually exists. I have also registered that OCX file with regsvr32 and it still isn't loading. Is there a way to fix this?

I also noticed that some references that existed on the other development machine offered newer versions of some of the controls I need, like Microsoft ActiveX DAO 2.8 Library. On the new dev machine, I only see Microsoft ActiveX DAO 2.5 Library. I'm not sure why this is because I used the same installation media of VBA on this new dev machine that was used to load it on the other machine. Why do the 2 machines have difference in version numbers for some of the controls?

EDIT1: Looking under Project>References I can see that 2 of them have been labeled as missing. These references are:

  1. Microsoft ActiveX Data Objects 2.8 Library, AND
  2. Microsoft VBScript Regular Expressions 5.5

EDIT2: The "new" development machine is Windows 2000.


回答1:


Sometimes when a project is migrated to a new computer, you end up with missing references. These are never fun to fix. But it essentially comes down to installing the missing files. There are several ways to do this:

Install Set

This is perhaps the easiest way. All dependencies are collected into a package that gets copied to the new computer and registered as needed.

Manually Install

Through a process of prior knowledge or searching the web, install packages are tracked down and applied to the new computer. So, for the issue at hand:

"Microsoft ActiveX Data Objects 2.8 Library" can be downloaded from the Microsoft site.

"Microsoft VBScript Regular Expressions 5.5" are available as part of Internet Explorer 5.5 and possibly more recent versions, too. Install IE and you'll be good to go.

Other Issues

Some components are actually on the computer but cannot be used for whatever reason. In your case with Microsoft Windows Common Controls 5.0 (comctl32.ocx), the first thing to try is as Etienne suggested. At an Administrator Command Prompt, unregister and re-register the control.

Another option is to upgrade your component to Microsoft Windows Common Controls 6.0.




回答2:


Try unregistering comctl32.ocx first:

Type REGSVR32 /U "C:\[filename.dll]"

Then re-register it again as you previously did. I've ran into this problem before and doing so fixed the problem. Make sure you run Command Prompt as Administrator.

As far as your other references, I suggest running Windows Update on both machines. You should have Microsoft ActiveX Data Objects 6.1.



来源:https://stackoverflow.com/questions/58841254/how-to-fix-broken-references-in-vb6

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!