Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 20

Predefined Compiler Constants

Visual Basic for Applications predefines two constants for use with the preprocessor: Win16 and Win32. These values are automatically available everywhere in a project (that is, they are global constants).

These constants exist for downward compatibility with projects that were originally created in VB 4.0, which developers could use to develop projects for both 16-bit and 32-bit Windows from the same source code.

In version 4.0 of VB, you could compile for either a 16- or a 32-bit platform. (In all previous versions, 16-bit was the only available platform; in subsequent versions, 32-bit is the only platform.) The values of the Win16 and Win32 constants depended on whether you were compiling on a 16-bit or 32-bit Windows platform. If you were compiling for a 16-bit platform (for example, Windows 3.1), the value of Win16 was defined as True, and the value of Win32 was defined as False. On 32-bit platforms (for example, Windows 9x and Windows NT), the values were reversed: Win16 was False, and Win32 was True.

In VB6, Win32 is always True and Win16 is always False. You no longer need to use compiler logic with Win16 and Win32 in your code. If you maintain code that was originally written in VB4, you may find these constants.

Leaving this compiler logic in your code does no harm in the VB6 environment, but neither does it do any harm to remove the Win16 logic: No future version of VB is ever going to support 16-bit code again.


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved