谢谢

解决方案 »

  1.   

    int  len=str.GetLength();  
     
               int  unicodeLen=MultiByteToWideChar(sourceCodepage,0,str,-1,NULL,0);  
     
               wchar_t            *  pUnicode;  
               pUnicode=new  wchar_t[unicodeLen+1];  
                 
               memset(pUnicode,0,(unicodeLen+1)*sizeof(wchar_t));  
     
     
               MultiByteToWideChar(sourceCodepage,0,str,-1,(LPWSTR)pUnicode,unicodeLen);  
      

  2.   

    最后一句改为
    MultiByteToWideChar(936,0,str,-1,(LPWSTR)pUnicode,unicodeLen);
      

  3.   

    int  len=str.GetLength();  
     
               int  unicodeLen=MultiByteToWideChar(sourceCodepage,0,str,-1,NULL,0);  
     
               wchar_t            *  pUnicode;  
               pUnicode=new  wchar_t[unicodeLen+1];  
                 
               memset(pUnicode,0,(unicodeLen+1)*sizeof(wchar_t));  
     
     
               MultiByteToWideChar(sourceCodepage,0,str,-1,(LPWSTR)pUnicode,unicodeLen);  
    MultiByteToWideChar(936,0,str,-1,(LPWSTR)pUnicode,unicodeLen);
      

  4.   

    unsigned char p[129];; //接受缓冲区    ZeroMemory(p,sizeof(p));; //接收缓冲区清零 
     
    int widecharlen=MultiByteToWideChar( //计算从Ansi转换到Unicode后需要的字节数    CP_ACP,    MB_COMPOSITE,    (char*)p, //要转换的Ansi字符串    -1, //自动计算长度    0,    0    );;    CString tmpstr;;    tmpstr.GetBuffer(widecharlen);; //为转换后保存Unicode字符串分配内存    MultiByteToWideChar( //从Ansi转换到Unicode字符    CP_ACP,    MB_COMPOSITE,    (char*)p,    -1,    tmpstr.GetBuffer(widecharlen), //转换到tmpstr    widecharlen //最多转换widecharlen个Unicode字符    );;
      

  5.   

    http://dev.csdn.net/develop/article/76/76100.shtm
      

  6.   

    第一步:包含头文件
    #include "comdef.h"
    第二步:
    char *str1="了";
    _bstr_t str=str1;
    WCHAR *str2=str;
    第三步:str2就是你要的Unicode