It is possible to write your source code so that it can be compiled using ANSI or Unicode characters and strings. In the WinNT.h header file, the following types and macros are defined:
#ifdef UNICODE typedef WCHAR TCHAR, *PTCHAR, PTSTR; typedef CONST WCHAR *PCTSTR; #define __TEXT(quote) L##quote #else typedef CHAR TCHAR, *PTCHAR, PTSTR; typedef CONST CHAR *PCTSTR; #define __TEXT(quote) quote #endif #define TEXT(quote) __TEXT(quote)
These types and macros (plus a few less commonly used ones that I do not show here) are used to create source code that can be compiled using either ANSI or Unicode chacters and strings, for example:
// If UNICODE defined, a 16-bit character; else an 8-bit character TCHAR c = TEXT('A'); // If UNICODE defined, an array of 16-bit characters; else 8-bit characters TCHAR szBuffer[100] = TEXT("A String");