Migrating Applications to Visual Basic 5.0

Valor Whisler
Senior Engineer, Crescent Division of Progress Software

February 21, 1997

Valor Whisler is a senior engineer for Crescent, a leader in the business of developing components and tools for Visual Basic. He has a lead role in helping Crescent deliver high quality, innovative, and useful products.

Abstract

Microsoft® Visual Basic® version 5.0 offers many new features and functions that make it worthwhile to move your applications to this platform. Of course, the most compelling reason for migration may be the fact that this latest version of Visual Basic creates native code executables—resulting in impressive performance gains over previous versions. In addition, the ability to create ActiveX™ controls and ActiveDocs, as well as other features, is well worth the migration from Visual Basic 3.0 or Visual Basic 4.0. This article will consider and discuss the following topics about migrating your existing Visual Basic 3.0 and 4.0 applications. Then, it will explain how to accelerate and ease that process using the Migration Wizard that ships with Visual Basic 5.0.

Issues to Consider

What are the issues to consider prior to migration? Most of the issues listed here are not specific to migrations of Visual Basic projects—rather, they are issues to consider when migrating to any type of software system.

Notable Changes to Visual Basic

This section provides a short list of changes to Visual Basic. This is by no means a complete list and only those changes that affect migration are discussed. Before I discuss some of these specific changes, I wanted to mention what I feel is the most significant change of all—the new approach to problem solving that was introduced in Visual Basic 4.0. The new architecture of Visual Basic 4.0 made possible the use of class modules and forms-as-objects as well as a major shift toward OOP. Fortunately, this same architecture is present in Visual Basic 5.0 along with the obligatory extensions and enhancements. This object-oriented shift in thinking really invites a change in the design of your Visual Basic 3.0 applications. Although it is not mandatory, undertaking this task can result in huge gains, such as modularization, which allows components to be reused. That aside, it is possible to merely migrate a Visual Basic 3.0 application directly to Visual Basic 5.0 without a redesign. And, as mentioned, the migration from Visual Basic 4.0 to Visual Basic 5.0 is much easier since the fundamental development process did not change.

Types of Change

There are several types of change to consider prior to your migration. Some changes are mandatory—that is, they must be done in order for your application to work in the new environment. Other changes are more to do with style or are cosmetic in nature. Some changes you make can increase coding efficiency or optimize your logic. Finally there are changes to the interface necessitated as older controls are phased out or newer controls with more functionality become available.

Plan of Attack

As mentioned earlier, it may be necessary to consider a migration as a full-blown versioning of the product. This, of course, depends on the scale and the scope of the change. This should go without saying, but make sure you back up your old project!

The Migration Wizard

Crescent Migration Wizard

A Migration Wizard developed by the Crescent Division of Progress Software is included in Visual Basic 5.0. It can be found in the directory \Tools\Unsupprt\Migrwiz. This tool provides a wizard-style interface that walks you through the process of migrating an earlier-version Visual Basic project to Visual Basic 5.0.

The Migration Wizard processes source files from a Visual Basic application, searching for Windows API Declare and Call statements, as well as declares and calls to third party DLLs. The Wizard performs one of two operations when it encounters an API or DLL function: it inserts a TODO: comment at the offending location, telling you what must be done to upgrade, or it changes the code automatically.

The wizard provides for the selection of a Visual Basic project and specification of a new directory where the modified source will be generated—it does not directly modify the original project. There are several options provided, including the following:

After all of the options have been selected in the wizard, the source files are then processed according to your specifications. This versatile tool can not only perform migrations itself, but can be used to learn what types of things to look for during a migration by reviewing the comments it generates.