Migrating old Visual Basic 6 applications to work on Windows 7 can be hard work. Microsoft gives a “it just works” guarantee for the old run-time but not the common and custom control packages heavily used in the past.
The Visual Basic 6 common controls package including most of the old libraries is available for download from Microsoft, but it could not get it to install on my Windows 7. Many of the libraries are also available for download on various download sites, but these files cannot be fully trusted.
I took a closer look at my Visual Basic 6 IDE installation running on one of my virtual machines and noticed that many of the libraries had a dep file by the same name. The dep files are Visual Basic setup wizard dependency files used by the old installers to point the location from where the library could be downloaded. All of these dep files pointed to the following URL:
For my surprise the URL still worked! Using the address one can download any on the old libraries simply by adding the library name and the cab extension to the address, e.g. to retrieve the library dblist32.ocx I used the URL http://activex.microsoft.com/controls/vb6/dblist32.cab. All the common libraries like comdlg32.ocx and dblist32.ocx are there! The server returns a cab file containing the ocx file and an inf file. After downloading all you need to do is to extract the ocx file, put it in your windows\system32 directory and register it using regsvr32.
Unfortunately the more you play around with the old libraries the quicker you face the old dll hell. The ocx libraries often depend on other ocx and dll files that then in turn depend on even more files. None of these dependencies are included in the cab file returned by the server, so to find out what additional files you need, do the following:
- Check the reference list in the vbp (Visual Basic project) file of the application
- Google for the dep file of the library you need to use
- Look into the vb6dep.ini for hints.
If you need to migrate even older applications starting from VB3, you can start by downloading the old run-times from here.
As time goes old software simply stop working. In most cases you can find a newer version to use, but when it comes to old tools like Visual Basic 6 Enterprise Edition, they are not so easy to replace.
I was asked to do some minor changes to an old (5-10 years) calculation program. By installing Visual Basic 6 ended up getting my Windows XP SP2 all messed up, so I eventually used more time to setup the IDE than for actually doing the code change! As the code changes I was asked to do were minor, it was difficult to justify to the customer why the complex application should be rewritten using modern tools.
After some struggling I got the old VB installed on a virtual machine. To help other facing the same problem, here is how:
1. Visual Basic 6 Enterprise Edition requires that Microsoft Java Virtual Machine 4 or later is installed. The setup might try to install the old version but fail. As Microsoft ended the support for MSJVM in June 2009 the only place to get the setup files are from some unofficial sites like the DMT homepage. Note that you might find the build 3810 from many places, but you will first need to install the older 3805 build!
2. Before running the setup first copy all the files from the CD on to your local hard drive. I don’t know the reason to why this is required.
3. The setup won’t start if you are running XP with a 32 bit color mode, so create a shortcut pointing to the setup executable and from the compatibility options turn on the Windows 95 compatibility mode and set the display settings to 256 colors.
4. When the setup starts, go through the wizard pages and make sure to uncheck every component (e.g. DCOM 98) you do not explicitly need!
You will most likely get some ActiveX and ADO errors during the installation, but eventually Visual Basic 6 should appear in your start menu and work.
If these steps did not do the trick, try disabling the Windows DEP (Data Execution Prevention). The easiest way to do this is by editing your C:\boot.ini and setting the /noexecute value to alwaysoff. If your firewall has a ISP (Intrustion Prevention) functionality, disable it.