【问题标题】:Using WideCharToMultiByte on Windows Mobile在 Windows Mobile 上使用 WideCharToMultiByte
【发布时间】:2012-09-24 17:15:31
【问题描述】:

我有为 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 上运行我的程序,这仍然有效吗?

【问题讨论】:

    标签: c++ unicode windows-mobile


    【解决方案1】:

    Windows Mobile 基于 Windows CE,根据文档,WideCharToMultiByte does not support the flag WC_NO_BEST_FIT_CHARS in Windows CE

    根据该页面,支持的标志是:

    WC_COMPOSITECHECK 将复合字符转换为预组合字符。 WC_DISCARDNS 在转换过程中丢弃非空格字符。 WC_SEPCHARS 在转换期间生成单独的字符。 (这是默认的转换行为)。 WC_DEFAULTCHAR 在转换期间用默认字符替换异常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-29
      • 2011-08-07
      • 2011-09-05
      • 1970-01-01
      • 2013-02-08
      • 1970-01-01
      • 2011-04-14
      • 2012-05-01
      相关资源
      最近更新 更多