MFC第三课多字节处理

DrawTextW (Unicode)和DrawTextA (ANSI)

,

unicode ,

ansi , 1

,

ANSIDrawTextA UnicodeDrawTextW


装运箱宽字节转换成多字节字符串


,空白CStringToChar (CString  strSrc, char *, pd, int 大小)
{
,, memset (pde, 0,大小),
,, int  nLength =, strSrc.GetLength ();
,, int  nBytes =, WideCharToMultiByte (CP_ACP 0 strSrc nLength, NULL, 0, NULL, NULL),
,, WideCharToMultiByte (CP_OEMCP, 0, strSrc,, nLength,, pd,, nBytes,,空,,NULL);,
,, pde [nBytes],=, 0;
};

注意:第二次调用WideCharToMultiByte主要是为了能够获取生成的长度


MFC第三课多字节处理