|
 |
|
Visual Basic runtime DLLs and Controls
When and how to install VB runtime DLLs, the OLE DLLs and
the Common Controls and Common Dialogs
|
Before you leave ---
Click the links to the left to investigate our software. Most of it is free.
We hope that the information here will help you to solve two common problems:
- Compiled Visual Basic programs refuse to run, giving "Unexpected error". The short answer:
- 1. Re-install the program which does not run. Many software installation programs supply
the runtime program and controls they require. (But ours do not so will probably not be fixed.)
- 2. Install the VB5 and VB6 runtimes to get the latest runtime and OLE DLLs.
- 3. Download and register the latest versions of the Common Controls.
- You cannot load a Visual Basic project into the IDE any more. The short answer:
- 1. Delete all the OCA files on your computer, VB will recreate them as needed.
- 2. Edit the project files to require Version 1.0 of all the controls.
- 3. If the errors include "Licence not found", remove the common controls and reinstall VB.
Please check all the items on this page. If the trouble is not resolved we are sorry, but we don't know what
to do either. This page is kept up to date with everything we know.
The VB authored Shareware and Freeware on this web site requires the VB5 runtime DLL msvbvm50.exe. Some
programs may require the versions of Comctl32.ocx and Comdlg32.ocx supplied with VB6, but we are in the process
of replacing them with versions that will run with the VB5sp3 controls.
Now for the long answers.......
Getting programs written in Visual Basic to run
To run programs written in VB you need to have on your computer the runtime DLL, a compatible set of
OLE DLLs and a suitable versions of the required controls. To install them or repair an existing installation
you should follow this sequence:
- If Windows is unable to run the program at all the VB runtime DLL MSVBVM50.DLL or MSVBVM60.DLL is
probably absent. Install it and the OLE DLLs it depends on, instructions are on this page
here.
- Most programs require the Common Controls Comctl32.ocx and Comdlg32.ocx. Some, but none of our programs
at the moment, require also Comct232.ocx or Comct332.ocx. If you have never installed Visual Basic or a
program written using it, the Common Controls will be absent. Check the System folder,
usually \Windows\System or \Winnt\System32. If these files are not found
download the ones supplied with VB6 and copy them to the Systems folder.
Then register the controls.
- The probable cause of error message boxes showing "Unexpected error" or "Error 50003" is that
an incorrect version of the common controls is registered. Instructions for correcting this problems
are on this page here.
- Repair the OLE DLLs if these steps do not result in a working installation. The symptoms are unspecified
System errors. The most likely cause on Windows 95 is re-installing the operating system without first
uninstalling IE4. In this case other operations such as Drag and Drop in Explorer do not work either.
Instructions for correcting this problems are on this page here.
The VB runtime DLL and OLE DLLs
Here are some places you can find the files to install msvbvm50.dll (for VB5), msvbvm60.dll (for VB6)
and a set of OLE automation DLLs:
- Get the install files from http://www.simtel.net/vbrun.php.
- For VB5, get MSVBVM50.EXE from the Microsoft web site. The information and download are in the Knowledgebase
article
Q180071 FILE: Msvbvm50.exe
Installs Visual Basic 5.0 Run-Time Files.
- For VB6, get VBRun60sp4.EXE from the Microsoft web site at
Q235420 FILE: VBRun60sp4.exe Installs Visual Basic 6.0 SP4 Run-Time Files.
- For VB5 install the Control Creation Edition of Visual Basic.
This free download is great for learning VB as well as creating controls. Currently you can find the download at
http://msdn.microsoft.com/vbasic/downloads/cce/default.asp. Should the page move, the best
search words are "Control Creation Edition".
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.
Information for Visual Basic programmers
Getting Visual Basic projects to load into the VB IDE
After registering different versions of controls VB may give errors when
trying to load your projects. Do the following in order, testing after each step to see if the problem
is resolved:
- VB may be using a Type Library cache file which refers to the wrong version of the control. These files
have the extension OCA. Delete all the OCA files and preferably clean up the registry using RegClean from
Microsoft or better still COMclean. VB will regenerate the OCA files as needed.
- The project file may specify a version of the type library which is not registered. This can be repaired
by editing the VBP project file to require version 1.0. As an example you will find the line
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX
for the Common Controls if the VB6 (Version 1.3) controls are required. Edit the project files to require
Version 1.0 of the controls. When the project loads the version of the control which is available will be used,
and the VBP file changed to suit. This is done regardless of the state of the "Update ActiveX controls" flag.
If you still get an "Unexpected error", try Version 1.1. If it still does not work, find out which version is
registered and use that. To use a specific version of a control make sure that it is the one which is registered.
COMclean from RHA (Minisystems) Ltd. can show which files are registered,
screen shots are on this page here.
- If you are getting "Licence not found..." the VB installation has not worked. Probably, the computer already
had the same or newer versions of some of the controls. The installation will not overwrite the files and does not
install the licences either. Unregister the controls and remove them from
the system folder. Reinstall VB and try again, the control OCXs and licences should have been installed.
You can now replace them by newer versions of the controls if you wish.
- The TypeLib section of the registry may contain version numbers which are not in fact available. The version
numbers which are not available may be higher or lower than the one which is available. An explanation of
how this situation arises is on this page here, how to fix the problem using
COMclean (including screen shots showing invalid type libraries) is described
here. The Microsoft Knowledgebase article is
Q221990
New projects and other considerations
- When you start a new project the currently registered controls are the only ones available. If you start a
VB5 project when the VB6 controls are registered, it will require the VB6 versions of the controls to run.
The VB compiler allows you to set an existing project to not upgrade ActiveX controls. If you do not
check this option, existing projects will be converted to use the VB6 controls.
- If your programs have been using newer controls than you wish, for example the comctl32 type VB6 controls
in a VB5 project, you can revert to the previous versions as described on this page.
- If you use Visual Basic and you make installation files, you should arrange for the controls used
by your projects to be in the System folder.
- You may upgrade your VB5 projects to use the new MSCOMCTL.OCX type controls. They are self contained and
unlike the comctl32.ocx series do not rely on comctl32.dll (recent version of which are often installed by
Internet Explorer). The download is at
http://msdn.microsoft.com/vbasic/downloads/axupgrade.asp.
Common controls download
You can download ZIP files containing the VB5 and VB6 controls from the rhaminisys site.
This list is not exhaustive.
Controls supplied with | Common controls | UpDown & Animation |
Coolbar | Common dialogs |
comctl32.ocx | comct232.ocx | comct332.ocx | comdlg32.ocx |
VB5 no service pack |
Date | 16/01/1997 |
16/01/97 | Not supplied | 16/01/97 |
Version | 5.00.3714 | 5.00.3714 | 5.00.3714 |
TypeLib | V 1.1 | V 1.0 | V 1.1 |
VB5 Control Creation Edition
Download link |
Date | 28/02/1997 |
Not supplied | Not supplied | 27/02/1997 |
Version | 5.00.3828 | 5.00.3714 |
TypeLib | V 1.2 | V 1.1 |
VB5 SP3
Download here |
Date | 19/07/1997 | 19/07/1997 | 29/07/1997 | 19/07/1997 |
Version | 5.01.4319 | 5.01.4319 | 5.01.4329 | 5.01.4319 |
TypeLib | V 1.2 | V 1.0 | V 1.0 | V 1.1 |
VB6
Download here |
Date | 23/06/1998 | 23/06/1998 | 23/06/1998 | 23/06/1998 |
Version | 6.00.8022 | 6.00.8022 | 6.00.8169 | 6.00.8169 |
TypeLib | V 1.3 | V 1.1 | V 1.1 | V 1.2 |
VB6 SP5 |
Date | 22/05/2000 | 24/06/1998 | 06/12/2000 | 22/05/2000 |
Version | 6.00.8105 | 6.00.8022 | 6.07.8988 | 6.00.8418 |
TypeLib | V 1.3 | V 1.1 | V 1.1 | V 1.2 |
Most of the other controls such as the Tabbed Dialog Control in tabctl32.ocx have the same version
number and file date as the corresponding comctl32.ocx. The downloads above include comdlg32.ocx,
comctl32.ocx, comct232.ocx, comct332.ocx and tabclt32.ocx. The Type Library versions are not
changed by applying SP5 to VB6. All these files are on the redistributable list.
You need a design time licence, installed with the VB system, to use the controls in your projects.
The version of comctl32.ocx supplied with VB5 Control Creation Edition can be installed by the
program COMCTLZP.EXE, downloadable from the Microsoft web site at
Q167121
It will not overwrite newer versions, so remove comctl32.ocx from the Systems folder (unregister first!)
before running the installation program.
Registered Type Libraries which are not available
When a control is registered, it makes an entry in the TypeLib section of the registry indicating which
version of the interface it supports. If a different version of the control is installed without unregistering
the previous one, such as when a service pack is applied, the later version is added to the TypeLib entry.
The previous version is not available despite being in the registry, because the control has been overwritten.
A worse situation arises when an installation program overwrites a control with an older version,
the newer version of the interface is the one which is no longer available. Programs may not be able to
run under these circumstances.
If the previous version of the control file was in a different location, the faulty registry entries can be
removed by unregistering it, then re-registering the new one. Usually, the previous
file is overwritten by the installation, and the registry entries must be removed by hand. To be sure of getting
rid of the faulty entries, first unregister the control, then delete all the
TypeLib registry entries which refer to the unregistered control file. Finally,
re-register the file. You can use COMclean to remove the faulty entries.
The next section shows an example with screen shots.
Fixing the registry with COMclean
The screen shot below shows the COMclean Class ID registry entries for some
of the controls. The "32-bit only server" header has been clicked to sort the entries by file name.
The controls are implemented by files in the Windows\System folder.
Below are the Type Library entries. The "Description" header has been clicked to sort the entries
by that column. Only V1.0 of the Coolbar in COMCTL332.OCX and V1.2 of the Common Controls are implemented
by the registered OCX files in the System folder. The various versions of COMCTL32.OCX have the same Class ID
so only one can be registered at one time. Versions 1.0, 1.1 and 1.3 of the Common Controls are
implemented in files located in other folders, so are not available. This example was created by registering
files in different locations in turn, ending with the one in Windows\System. COMclean does not mark the
unavailable Type Library versions as invalid because the file implementing them exists.
It is probable that you will find that all the versions refer to the same file. You can delete them
all and then re-register the file to restore just the correct entry. Unregistered COMclean allows you to
examine the registry entries, but to use it to delete them you must register the program.
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.
Checking the OLE DLL versions
Usually, installing the Visual Basic runtime files will fix the OLE DLLs as well.
If you have followed all the other steps and there are still problems, you should check the OLE DLL versions.
In these cases you may see a message such as
In this case the system may be using a wrong DLL version. Check the versions of the files against those
specified in the articles
Q180071 and
Q192461.
There is a known problem caused by re-installing Windows 95 without un-installing Internet
Explorer 4, which leads to an incompatible set of DLLs. In this particular case one of the effects may be that
Drag and Drop in Windows Explorer does not work. There is a series of Knowledgebase articles explaining how to
remedy this situation, what it boils down to is replacing the complete set of DLLs with the original
Windows95 ones.
Q129605
How to Extract Original Compressed Windows Files.
Q135174
Cannot Access CD-ROM Drive from MS-DOS Mode or Command Prompt.
Q171241
Cannot Manually Extract Files from Cabinet Files.
Q166313
Removing Internet Explorer 4 for Windows 95 Using Ieremove.exe.
Q172919
Uninstall Internet Explorer 4.0 Option Is Missing.
Q174265
How to Uninstall Internet Explorer 4.0.
Q174549
Reinstalling Windows 95 with Internet Explorer 4.0.
Q175610
How to Manually Uninstall Internet Explorer 4.0.
The above articles describe extracting the files from the Windows 95 CDROM. You can extract a compatible set
more easily from one of the VB runtime installation files mentioned above, using WinZip or another extractor.
Whichever way you obtain them you should boot up in DOS mode to copy them over the faulty set.
Make sure to have a backup before you overwrite, and ensure you are using a complete and compatible set.
Follow the procedures outlined in the articles above.
Back to the RHA (Minisystems) Ltd home page
http://www.rhaminisys.com
|