I have code designed for Win32 (XP and later) that I am porting to Windows Mobile 6. It contains this line:
int count = ::WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, ..., 0, 0 );
On Windows XP, this works fine, but on Windows Mobile it returns 0 and GetLastError() returns error 1004 “Invalid flags”. WC_NO_BEST_FIT_CHARS is defined in winnls.h in the Windows Mobile 6 SDK.
This code will work in my limited tests if I either replace the call with ::wcstombs or replace WC_NO_BEST_FIT_CHARS with 0.
I’d like to know what is the ramification of making either of those changes. Will this still work if I run my program on a Chinese or Russian version of Windows Mobile?
Windows Mobile is based on Windows CE, and acording to the documentation, WideCharToMultiByte does not support the flag WC_NO_BEST_FIT_CHARS in Windows CE.
According to that page, supported flags are:
WC_COMPOSITECHECK Convert composite characters to precomposed characters. WC_DISCARDNS Discard nonspacing characters during conversion. WC_SEPCHARS Generate separate characters during conversion. (This is the default conversion behavior). WC_DEFAULTCHAR Replace exceptions with the default character during conversion.