Using Masm32 v11 Unicode (All Project Type)


Version 11 of Masm32 allows you to program Unicode applications in a very easy way by defining the __UNICODE__ constant. Taking advantage of this new feature, Easy Code adds the Masm32 Unicode mode new option, in the Project properties. If this check box is ticked, the __UNICODE__ constant will be internally defined by the IDE so that all API functions, structures and constants take their Unicode values.

In order to be able to select/unselect this new option, the Build project as Unicode (Windows NT or later) check box must be selected, otherwise it will be disabled. Both options make the built application to work in Unicode mode, but there is a relevant difference between them:

For visual projects, the Build project as Unicode (Windows NT or later) option makes the built application to check (at run time) the platform where it is running on. If the platform is prior to Windows NT 4.0, the application runs in ANSI mode. Otherwise, if the platform is Windows NT 4.0 or later, the application runs in Unicode mode. Due to that reason, you must be always aware of what mode the application is running on when writing code in order to call the right version of API functions ("A" or "W" terminated) at any time. For more information, please see the ANSI / Unicode applications topic.

On the other hand, the Masm32 Unicode mode option makes no checking at run time, it just defines or not the Masm32 __UNICODE__ constant (both, visual and classic projects), what makes the compiler to refer to the corresponding version of API function, "A" or "W" terminated. When this option is selected, the application will always be compiled calling to the Unicode version of all API functions, structures and constants (unless the code specifically refers to "A" terminated versions). As a result, the built application will not work on Windows 95/98/ME.

Taking into account everything said above, you can select both, Build project as Unicode (Windows NT or later) and Masm32 Unicode mode in your project, but ONLY if you want to make an application just running on Windows Unicode operating systems (Windows NT and later).

The Theming example for testing this new option has been added in the Examples folder. The Theming project enables or disables the visual styles in Windows XP and later systems. By selecting or unselecting the Build project as Unicode (Windows NT or later) and Masm32 Unicode mode options, you will build, respectively, a Unicode or an ANSI application without having to modify the code at all.


REMARKS: The Masm32 Unicode mode option has no effect for versions of Masm32 prior to v11.