?
Solved

Multilanguage support

Posted on 2003-03-01
8
Medium Priority
?
217 Views
Last Modified: 2010-04-01
How can I enable my Windows application to output characters(into edit box) in different languages?
0
Comment
Question by:serg111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 8048024
What has this to do with C++?
0
 
LVL 2

Author Comment

by:serg111
ID: 8048302
So where should it be?
0
 
LVL 32

Accepted Solution

by:
jhance earned 800 total points
ID: 8048384
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:cup
ID: 8051307
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
 
LVL 2

Author Comment

by:serg111
ID: 8051958
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
 
LVL 11

Expert Comment

by:cup
ID: 8053459
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
 
LVL 2

Author Comment

by:serg111
ID: 8054081
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
 
LVL 11

Expert Comment

by:cup
ID: 8059690
Don't know about Unicode on Borland.  Perhaps someone else out there can help you.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question