使用LCMapString完成繁体中文到简体中文的相互转换

 

 

  TCHAR szOutBuffer[128+1] = {0};
  WORD wLanguageID = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED);
  LCID Locale = MAKELCID(wLanguageID, SORT_CHINESE_PRCP);
  int iRet = LCMapString(Locale,
      LCMAP_SIMPLIFIED_CHINESE,
      _T("亞洲"), -1,
      szOutBuffer, 128*sizeof(TCHAR));
  if(iRet == 0)
  {
    DWORD dwErr = GetLastError();
    ASSERT(0);
  }

  ASSERT( _tcscmp(szOutBuffer, _T("亚洲")) == 0 );


 

  TCHAR szOutBuffer[128+1] = {0};
  WORD wLanguageID = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED);
  LCID Locale = MAKELCID(wLanguageID, SORT_CHINESE_PRCP);
  int iRet = LCMapString(Locale,
    LCMAP_TRADITIONAL_CHINESE,
    _T("亚洲"), -1,
    szOutBuffer, 128*sizeof(TCHAR));
  if(iRet == 0)
  {
    DWORD dwErr = GetLastError();
    ASSERT(0);
  }
  
  ASSERT( _tcscmp(szOutBuffer, _T("亞洲")) == 0 );

你可能感兴趣的:(其它,系统/线程/调试)