我有为Win32(XP及更高版本)设计的代码,我将其移植到Windows Mobile 6.它包含以下行:
int count = ::WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, ..., 0, 0 );
在Windows XP上,这样可以正常工作,但在Windows Mobile上它返回0并且GetLastError()返回错误1004“无效标志”。 WC_NO_BEST_FIT_CHARS
在Windows Mobile 6 SDK的winnls.h中定义。
如果我将调用替换为::wcstombs
或将WC_NO_BEST_FIT_CHARS
替换为0,则此代码将在我的有限测试中有效。
我想知道做出这些改变的后果是什么。如果我在中文或俄文版的Windows Mobile上运行我的程序,这仍然有用吗?
答案 0 :(得分:3)
Windows Mobile基于Windows CE,并根据文档WideCharToMultiByte does not support the flag WC_NO_BEST_FIT_CHARS in Windows CE。
根据该页面,支持的标志是:
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.