Solved

UNICODE X MFC

Posted on 2004-08-19
5
292 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
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…

760 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

20 Experts available now in Live!

Get 1:1 Help Now