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.....

Member Avatar for iamthwee

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.

ouch drawing each of them....isn't there an easier way like creating a lib that uses the chars in that lib??

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 ]

...

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);

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.