|
When and how to install VB runtime DLLs, and the Common Controls and Common Dialogs
Replacing the Common Controls
Error message boxes saying "Unexpected error" or "Error 50003" may be symptoms of an incorrect version
of the common controls being registered. Microsoft have issued at least 4 versions of comctl32.ocx and 2
of comdlg32.ocx, comct232.ocx and comct332.ocx.
All the versions of each component have the same GUID but they are not compatible.
This breaks the rules of COM but Microsoft allow themselves to break their own rules
however much havoc it causes amongst their customers.
A compiled VB program will work with the set of controls it was compiled with or later versions.
However, programs complied with a newer issue of one of these OCXs will not run
if an older one is registered. If a VB5 authored program on this web site has this problem it needs
the VB6 versions of the controls.
Download the required version and unzip the files into a separate location.
For safety do not directly overwrite the Windows\System directory.
Unregister the old controls and move them to a temporary location.
Then copy the new controls to the System folder and register them.
You can register the new controls wherever they are, but some depend on DLLs in the System folder and may not
work in another location. To switch back to the original files, reverse the process.
More points to note:
- Any installation program may install and register a newer version of an OCX without the user noticing,
because all existing programs still run. If you install a program written using VB6 it is very likely to install
the VB6 versions of the controls to the System folder, overwriting older versions.
- OCX files may be placed anywhere on the disk, it is only convention to put them in the Windows System folder.
If there are different versions of the same file in different places, only the most recently registered one is
accessible. As already noted, they may not work in other places due to regular (non-COM) DLL dependencies.
- Under Windows NT, if you move a registered OCX the Windows registry is updated to point at the new location.
If the file is deleted to the recycle bin, the registry points there.
- VB6 introduced a completely new common control file called MSCOMCTL.OCX. This does not cause any problems
because the GUID was changed along with the file name. We are concerned here with the modified versions
of the VB5 controls which VB6 also installs.
Registering controls
To register an OCX type at the command prompt regsvr32 whatever.ocx
To unregister an OCX type at the command prompt regsvr32 -u whatever.ocx
You can also add right click context menu items to OCX files to perform these operations. It is
convenient to use the free File Association Editor, whose help file details
the registry entries required.
|