I want to translate a string of Traditional Chinese into Simplified
Chinese in WinCE5.0.
I use the function LCMapString but always failed.
The follow is sample code from MS,it's return ERROR 1004
(ERROR_INVALID_FLAGS).
If LCMapString cannot support the parameter LCMAP_SIMPLIFIED_CHINESE
in WinCE5.0?
Thanks inadvance !
#include <stdio.h>
#include <windows.h>
///////////////////////////////////////////////////////
void main(void)
{
#ifdef UNICODE
TCHAR Buf1[16] = {0x96FB, 0x8996, 0x0000};
TCHAR Buf2[16];
#else
BYTE Buf1[16] = {0xEB, 0x8A, 0xD2, 0x95, 0x00};
BYTE Buf2[16];
#endif
if(!LCMapString(0x0804, // Locale id of simplified Chinese.
LCMAP_SIMPLIFIED_CHINESE,
Buf1, -1,
Buf2, 16))
{
printf("LCMapString failed with Error# = %d", GetLastError());
}
else
{
#ifdef UNICODE
printf("\nLCMAP_SIMPLIFIED_CHINESE:\tU+%04x U+%04x -> U+%04x U+
%04x\n",
Buf1[0], Buf1[1],
Buf2[0], Buf2[1]);
#else
printf("\nLCMAP_SIMPLIFIED_CHINESE:\t"
"0x%02x%02x 0x%02x%02x -> 0x%02x%02x 0x%02x%02x\n",
Buf1[0], Buf1[1], Buf1[2], Buf1[3],
Buf2[0], Buf2[1], Buf2[2], Buf2[3]);
#endif
if(!LCMapString(0x0804, // Locale id of simplified Chinese.
LCMAP_TRADITIONAL_CHINESE,
Buf2, -1,
Buf1, 16))
{
printf("LCMapString failed with Error# = %d",
GetLastError());
}
else
{
#ifdef UNICODE
printf("\nLCMAP_TRADITIONAL_CHINESE:\tU+%04x U+%04x -> U+
%04x U+%04x\n",
Buf2[0], Buf2[1],
Buf1[0], Buf1[1]);
#else
printf("\nLCMAP_TRADITIONAL_CHINESE:\t"
"0x%02x%02x 0x%02x%02x -> 0x%02x%02x 0x%02x%02x\n",
Buf2[0], Buf2[1], Buf2[2], Buf2[3],
Buf1[0], Buf1[1], Buf1[2], Buf1[3]);
#endif
}
}
}