Conditional compilation was added in Visual Basic 4 to allow the use of a common code base between the 16-bit and 32-bit versions, but it also offers a number of other advantages. For example, conditional compilation can be usedto exclude certain features from demonstration versions of programs. (Leaving out printing and saving capabilities will render a large number of programs useless for all purposes other than demonstration.)
Note If you want to maintain a code base that allows for conditional compilation under both Visual Basic 5 and 16-bit Visual Basic 4, it is worth knowing that although 16-bit Visual Basic 4 will not read Visual Basic 5 project files, it will read Visual Basic 5 form code and class modules. In 16-bit Visual Basic 4, you might need to remove the version number from the beginning of the text files. Thus, a program designed and written to compile and run under either 16-bit or 32-bit Visual Basic 4 can be compiled under either 16-bit Visual Basic 4 or 32-bit Visual Basic 5, provided you don’t save the changes to the project file. Any new Visual Basic 5 properties generate an error when the forms are loaded, but in many cases you can ignore this error. This can be illustrated by experimenting with the CALLDLLS sample program from the Visual Basic 4 installation. The beginning of a Visual Basic 5 form module opened as a text file looks something like this:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2640
The first line might need to be removed, and the text file might need to be saved to allow the module or form to load into 16-bit Visual Basic 4.