如题;有没有什么最简便的方法。
CHAR char[128];
GetWindowText(char,128);WCHAR wchar[128];
怎么将char转化为wchar?太复杂的不要;
可以用到CString等数据类型

解决方案 »

  1.   

    你是Unicode工程还是MBCS工程?
      

  2.   

    什么样的char? 汉字还是英文,做法是可以不一样的。
      

  3.   

    我是想用GDI+输出文字DrawString
    但是参数需要WCHAR*
    我得到的是char*
      

  4.   

    char to wchar
    MultiByteToWideChar();
      

  5.   

    CString strText;
    CWnd::GetWindowText(strText);
      

  6.   

    MultiByteToWideChar能给个代码吗?具体怎么用
      

  7.   

    MultiByteToWideChar能给个代码吗?具体怎么用
      

  8.   

    ing g____ansi_codepage = 0;
    //**************************************
    // ansi字符串转unicode字符串
    // 返回大于0成功,小于0失败
    //**************************************
    int
    astr_ustr( char *ansistr, WCHAR *unicodestr )
    {
    int result = 0;
    try
    {
    int needlen = MultiByteToWideChar( g____ansi_codepage, 0, ansistr, -1, NULL, 0 );
    if( needlen < 0 )
    {
    return needlen;
    } result = MultiByteToWideChar( g____ansi_codepage, 0, ansistr, -1, unicodestr, needlen );
    if( result < 0 )
    {
    return result;
    }
    return result;
    }
    catch( ... )
    {
    ShowError();
    }
    return result;
    }