What's the proper source for Windows Common Co

2019-02-12 18:00发布

问题:

I'm experimenting with writing ActiveX controls and noticed that I can't seem to create an ActiveX control in Visual Basic (6.0) which features slightly more sophisticated controls. Simple controls like labels, buttons and check boxes seem to work fine, but as soon as I try to add e.g. a tree control to my form, the ActiveX control stays entirely blank as soon as I embed it into some host application on another computer. It works fine on my development box though.

While going through the Projects->Components (Ctrl+T) list, I found two libraries which apparently contain a tree control:

  • Microsoft Windows Common Controls 5.0 (SP2)
  • Microsoft Windows Common Controls 6.0 (SP6)

As soon as I add any of the controls from these libraries to my form, the form stays entirely gray when embedded on another computer. The other computer is a Windows XP system, so I hoped that missing redistributables wouldn't be an issue, given how old Visual Basic 6 is. To be sure, I installed the VB6 redistributables, but unfortunately that didn't make a difference.

Does anybody know why my ActiveX control would stay gray on other computers, but not on mine, as soon as I add any of the controls from the above libraries to me form? FWIW I just need a tree control so if there is some other, more appropriate, library available - that's fine with me.

UPDATE: As it turned out, it helps to download MSCOMCTL.OCX into C:\WINDOWS\SYSTEM32 on the other computer and then registering it via regsvr32 C:\WINDOWS\SYSTEM32\MSCOMCTL.OCX. However, I didn't find an official source for this file, and running the COM registration by hand looks cumbersome to me. Is there really no redistributable I could use?

回答1:

VB6 runtime is preinstalled on XP and above but the Common Controls component you are referencing is not.

Try installing Microsoft Visual Basic 6.0 Common Controls redistributable on the client machines or event better make a setup for your application.

Edit:

Opps, the link is for an update that does not install the OCXs if not already present. The only redistributable I find is a merge module for Windows Installer.



回答2:

To solve this problem, I developed a .msi package. The source files (WiX) and stake posted here: https://github.com/IT-Service/ITG.VB6CommonControlsRedist



标签: com vb6 activex