Re: _UNICODE

From: Bob Leschorn (blesch@cix.compulink.co.uk)
Date: Fri Jan 29 1999 - 05:09:00 EST


In-Reply-To: <9901270655.AA13496@unicode.org>
In article <9901270655.AA13496@unicode.org>, vmurthy@teil.soft.net
(Venkatesh Murthy N G) wrote:

> Hi,
>
> what is the difference between #define UNICODE and #define _UNICODE.
>
> To support application to be run with Japanese language support do we
> need to include both ?
>
> I need reply soon because some of the API's are giving error if I
> include this line i.e. #define UNICODE
>
> venky
>

#define UNICODE is all you need if not using MFC I believe. The reason you
might be getting API errors is because this causes the compiler to use the
'wide', ie. Unicode, versions of certain routines. For instance, if you
use TextOut() in your program, if UNICODE is not defined, the compiler
will reference TextOutA() which expects a char * for it's string argument.
If UNICODE **is** defined, the compiler will reference TextOutW() instead
and this expects a wchar_t * (wide character string) for it's string
argument.

If you use TCHAR * and TCHAR wherever you would use strings and characters
as arguments and you define _UNICODE, this will cause TCHAR to be defined
as wchar_t. If you **are** using MFC, you must define _UNICODE I believe
as the CString class, amonst others, will not work correctly.

Since you are working solely in NT, you can happily work 100% in Unicode
and forget about MBCS. Nonetheless, excellent articles on MBCS can be
found at:

        www.microsoft.com/globaldev/fareast/mbcssg.htm
        
Another article of interest to you might be:

        www.microsoft.com/globaldev/fareast/fewinnt.htm

=========================================================================
Bob Leschhorn blesch@arksoft.com
Ark Software blesch@cix.compulink.co.uk
Gerrards Cross, Bucks Tel: +44 (0)1753 887431
United Kingdom Fax: +44 (0)1753 884693
=========================================================================



This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:44 EDT