Solved

UNICODE MFC very newbie :) VC6

Posted on 2003-10-27
8
956 Views
Last Modified: 2013-12-03
Hi Experts

Im am thinking of writting for many languages. I know there is UNICODE.
But what about the how?


I read there are TCHAT and _T( ) and the Macro..  

How do I choose what language to display the text as?

Also are there any Turorials on the topic.

Thanks
Barry
0
Comment
Question by:barryhs
8 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 250 total points
ID: 9631936
Try these links

http://www.codeproject.com/cpp/unicode.asp - Unicode, MBCS and Generic text mappings
http://www.codeproject.com/tips/internationalization.asp - Tips on internationalization of software

Good luck
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9631960
http://www.codeproject.com/cpp/switch_languages.asp - Multilingual Application - Change Application Language
0
 
LVL 8

Expert Comment

by:_corey_
ID: 9637493
Did you install VS6 with UNICODE support? If not, reinstall.
0
 

Author Comment

by:barryhs
ID: 9647089
Hi thanks so far...

What is the reason for specifying the entry point symbol in your Project settings as wWinMainCRTStartup??

Ok the rest of the stuff I knew of..
Basicaly UNICODE is is almost a style ..
eg: _T() and changeing funtion names bla bla...

I Need a realy specific answer then..
Lets say I want the letter to be in a string, or title or in a CStatic , that is equal to the letters "yi" when I set my language to Japanese?

Please dont asume I know anything. Rather tell me everything.

Thanks
again Barry

0
 
LVL 6

Expert Comment

by:purpleblob
ID: 9663214
Basically _T and TCHAR are simply #defines which, depending upon your build will be single or double byte.

Now the point is that this means that if you build for UNICODE and deploy in a language that uses UNICODE then all your chars will actually be wchar_t in size meaning that the UNICODE strings are interpreted/displayed correctly. UNICODE is easy as is single byte character sets as each character is of uniform size. Where things get complicated is on MBCS (multi-byte character sets) whereby a character length may be char in size or wchar_t in size. With these character sets things get tricky as a character string may have a one byte character followed by a two followed by a one etc.

Okay so, the basic problem is now out of the way. if you try and use STL to store your strings, then this can only (from my recollection under VC++ 6) handle uniform character sizes and the MFC CString class, whilst able to handle MBCS has some funcitonality that doesn't work correctly - this is why I ended writing my own string class when I last did this stuff.

The problem is specifically if you wish to iterate through a "string", i.e. if you've a MBCS with different size characters, then you cannot simply go

for(int i = 0; i < _tstrlen(buf); i++)
{
  ... =  buff[i];
}

As this will expect each character to be of the same size. You need to use functions such as  _tcsnextc to get the next character (whether it be a single or double byte character).

Basically you'll need to review the tstr or _tstr type functions as these are #define'd to use either the single, multi or wide char versions of these functions.

Or if you do not need to support non-UNICODE versions of Windows then simply recompile everything for UNICODE :-)

Hope this helps
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now