Multilanguage support

How can I enable my Windows application to output characters(into edit box) in different languages?
LVL 2
serg111Asked:
Who is Participating?
 
jhanceCommented:
What has this to do with C++?
0
 
serg111Author Commented:
So where should it be?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
cupCommented:
On Windows, you can use either Unicode or MBCS.  Unicode is a lot easier to program but make sure you don't get caught out by sizeof.

Normally, when passing a buffer into a routine, you'd do something like

char buff[128];
dosomething (buff, sizeof(buff));

With Unicode, use either TCHAR or wchar.  The problem is that sizeof(TCHAR) != sizeof(char) so you'll have to do something like

TCHAR buff[128];
dosomething (buff, sizeof(buff) / sizeof(buff[0]));

Alternatively #define your own sizeof

#define SIZEOF(x) (sizeof(x)/sizeof(x[0]))
TCHAR buff[128];
dosomething (buff, SIZEOF(buff));
0
 
serg111Author Commented:
I set it to TCHAR but I still have a problem:

It works fine with English language, but when I switch to any different language and type to edit control 4 letters - it looks like correct language and font.
But when I try to get content of edit control to buffer - I'm receiving wrong string :-(

iTextLingth=4;
TCHAR *aBuffer=(TCHAR *)pTMyEdit->LockBuffer(iTextLength+1);

after that aBuffer contains 4 char "????" (code 0x3F)
0
 
cupCommented:
I'm assuming you are using VC6.  Check Settings...->C/C++->General->Preprocessor Definitons.

Replace _MBCS with _UNICODE,UNICODE

You will need both: some header files take UNICODE, some take _UNICODE.

If you are using VC7 (.net), MBCS may or may not be set.  It is somewhere in the language properties.  You have to change it to Unicode.
0
 
serg111Author Commented:
I'm using Borland C 5.02 and it requires definition of  'UNICODE' to enable wide version of functions

So I added 2 lines:
#define UNICODE  
#define _UNICODE  

and got lot of errors during compiling in header files

memory.h
inline _TCHAR CharUpper(_TCHAR c) {::AnsiUpperBuff(&c,1); return c;}
"can not convert 'wchar_t *' to 'char *'

etc. :-(
0
 
cupCommented:
Don't know about Unicode on Borland.  Perhaps someone else out there can help you.
0
All Courses

From novice to tech pro — start learning today.