c++ project for JAPANESE learning

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2004
Posts: 129
Reputation: johnroach1985 is an unknown quantity at this point 
Solved Threads: 0
johnroach1985's Avatar
johnroach1985 johnroach1985 is offline Offline
Junior Poster

c++ project for JAPANESE learning

 
0
  #1
Jan 29th, 2006
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
  1. strcpy(Kanji[1][1], "ã?² ã?¨ ( ã?¤ )");
on my computer when I use
  1. 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.....
"By the data to date, there is only one animal in the Galaxy dangerous to man—man himself. So he must supply his own indispensable competition. He has no enemy to help him."
From Time Enough for Love by Robert A. Heinlein
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,273
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 378
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: c++ project for JAPANESE learning

 
0
  #2
Jan 29th, 2006
Originally Posted by johnroach1985
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
  1. strcpy(Kanji[1][1], "ã?² ã?¨ ( ã?¤ )");
on my computer when I use
  1. 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.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 129
Reputation: johnroach1985 is an unknown quantity at this point 
Solved Threads: 0
johnroach1985's Avatar
johnroach1985 johnroach1985 is offline Offline
Junior Poster

Re: c++ project for JAPANESE learning

 
0
  #3
Jan 29th, 2006
ouch drawing each of them....isn't there an easier way like creating a lib that uses the chars in that lib??
"By the data to date, there is only one animal in the Galaxy dangerous to man—man himself. So he must supply his own indispensable competition. He has no enemy to help him."
From Time Enough for Love by Robert A. Heinlein
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: c++ project for JAPANESE learning

 
0
  #4
Jan 29th, 2006
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
  1. #ifndef _UNICODE
  2. #define _UNICODE
  3. #endif
in your header files


Then
  1. 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.
  1. TCHAR Kanji[ 2 ][ 3 ]
...
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: c++ project for JAPANESE learning

 
0
  #5
Jan 29th, 2006
OKay here is a solution which I compiled and worked.

Use this in your main header file.
  1. #include <windows.h> // Keep this above all the include files.
  2. #ifndef UNICODE
  3. #define UNICODE
  4. #endif
  5. #include <TCHAR.H>

This worked at the Event where I wanted to display the message box.

  1. TCHAR Kanji[ 10 ] = TEXT("");
  2. _tcscpy(Kanji, TEXT("ã?² ã?¨ ( ã?¤ )"));
  3. MessageBox( hWnd, Kanji, TEXT("Kanji"), MB_OK);
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 71
Reputation: AhmedHan is an unknown quantity at this point 
Solved Threads: 1
AhmedHan's Avatar
AhmedHan AhmedHan is offline Offline
Junior Poster in Training

Re: c++ project for JAPANESE learning

 
0
  #6
Jan 30th, 2006
Originally Posted by johnroach1985
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
  1. strcpy(Kanji[1][1], "ã?² ã?¨ ( ã?¤ )");
on my computer when I use
  1. 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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC