| 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.
More you can find here |