Hi.I have been trying to write a simple program that teaches how to read and write Japanese.Unfortunately not every windows does not support Jpanese characters.So like when my program starts I have a pop up which has to give a japanese chared message altough I write the code as such
strcpy(Kanji[1][1], " ( )");
on my computer when I use
MessageBox(hWnd, Kanji[1][1], "Kanji", MB_OK);
the message box gives me some odd chars....If there is a way in cpp to get over this problem please help me.....
One way, but not gud, wud b 2 add ur own japanese charecter library, using a winAPI. yes it wud be tedious to draw all charecters but u r garanteed a standard for all systems.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Okay try the following, but not sure if it will work. I got a similar problem since I am working on a Japanese OS.
Try this
_tcscpy(Kanji[1][1], L" ( )" );
The 'L' is not a mistake. Use it before the "" marks
Use
#ifndef _UNICODE
#define _UNICODE
#endif
in your header files
Then
MessageBox(hWnd, Kanji[1][1], "Kanji", MB_OK);
should work.
I could not check it so no guarantees, anyway try it and tell me what you get.
PS. Kanji should be of type TCHAR.
e.g.
TCHAR Kanji[ 2 ][ 3 ]
...
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
OKay here is a solution which I compiled and worked.
Use this in your main header file.
#include <windows.h> // Keep this above all the include files.
#ifndef UNICODE
#define UNICODE
#endif
#include <TCHAR.H>
This worked at the Event where I wanted to display the message box.
TCHAR Kanji[ 10 ] = TEXT("");
_tcscpy(Kanji, TEXT(" ( )"));
MessageBox( hWnd, Kanji, TEXT("Kanji"), MB_OK);
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Hi.I have been trying to write a simple program that teaches how to read and write Japanese.Unfortunately not every windows does not support Jpanese characters.So like when my program starts I have a pop up which has to give a japanese chared message altough I write the code as such
strcpy(Kanji[1][1], " ( )");
on my computer when I use
MessageBox(hWnd, Kanji[1][1], "Kanji", MB_OK);
the message box gives me some odd chars....If there is a way in cpp to get over this problem please help me.....
John-san,
Instead of using MessageBox(), you must use wide-char version of it, MessageBoxW(). Parametres are same for it, except for the title and text. Title and text must be in the WCHAR type.
And replace strcpy() with wcscpy() or StringCbCopyW().
Use L prefix.
"String" --> 8-bit chars
L"String" -> 16-bit chars
AhmedHan
Junior Poster in Training
71 posts since Apr 2005
Reputation Points: 13
Solved Threads: 1