Solved

UNICODE X MFC

Posted on 2004-08-19
5
309 Views
Last Modified: 2013-11-20
Hello!

I have MFC 4.2 (I guess) and I would like to know if it is possible to use Unicode font encoding.
I need to show Korean characters.

In afirmative case, how difficult would it be?

Thanks in advance,

Hederglan
0
Comment
Question by:hederglan
[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
  • 2
5 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 11839358
>I have MFC 4.2 (I guess) and I would like to know if it is possible to use Unicode font encoding.
Yes, it is possible. There is a mfc42u.dll which is the UNICODE version of mfc42.dll

>In afirmative case, how difficult would it be?
You have to define the UNICODE and _UNICODE in your project settings.
You can use an of the TCHAR derived types (LPTSTR, etc), CString too, be carefull not to use char * when trying to display Korean chars.
You can also use functions like mbstowcs(..) which transforms a nonUNICODE string into a UNICODE one, and wcstombs which does the reverse.
0
 
LVL 13

Accepted Solution

by:
SteH earned 150 total points
ID: 11839364
Some hints can be found at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_unicode_topics.asp

If you find a MFC42U.DLL in your system directory after the custom installation you can do it. (other DLLs are needed for UNICODE applications to work but this one should be there).

All strings are based on TCHAR and not CHAR. Constants can be defined as _T("This is the string") or L"This is the string". Latter is unicode only whereas the first can be compiled with ANSI or UNICODE. And for normal string operations ie strlen you need to use the wide version wstrlen.
0
 
LVL 1

Author Comment

by:hederglan
ID: 11840302
What I exactly need to do is showing Korean characters in a TextBox.
This data is read from a text file and stored in an object of the class X...
In the class X there is a member that stores the sequency of characters in a string (string MemberThatStoresTheSequencyOfCharacters)...
May I use string?
Using string do I have to define UNICODE and _UNICODE?

I guess anyway I will have to install those MFC libraries to Unicode...

Thanks.
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11840337
You can use wstring.
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

631 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