码迷,mamicode.com
首页 > Windows程序 > 详细

windows核心编程随笔

时间:2014-11-01 21:46:59      阅读:346      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   sp   div   art   log   bs   

MultiByteToWideChar(char *转Unicode)
    char text[256] = {0};
    char text1[256] = {0};
    int i=0;

    GetDlgItemTextA(this->m_hWnd,IDC_EDIT1,text,256);
    int j= strlen(text);
    while (j)
    {
        text1[i] = text[j-1];
        i++;
        j--;
    }
    int len = MultiByteToWideChar (CP_ACP, 0, text1, -1, NULL, 0);
    TCHAR* text2 = new TCHAR [len];
    MultiByteToWideChar (CP_ACP, 0, text1, -1, text2, len);
    SetDlgItemTextW(IDC_TEXTOUT,text2);
    //SetDlgItemTextA(this->m_hWnd,IDC_TEXTOUT,text1);
    delete []text2;
WideCharToMultiByte(Unicode转char *)

    WCHAR text[256] = {0};
    WCHAR text1[256] = {0};
    int i=0;

    GetDlgItemTextW(IDC_EDIT1,text,256);
    int j= wcslen(text);
    while (j)
    {
        text1[i] = text[j-1];
        i++;
        j--;
    }
    int len = WideCharToMultiByte (CP_ACP,NULL,text1,-1,NULL,0,NULL,FALSE);
    char* text2 = new char [len];
    memset(text2,0,len);
    WideCharToMultiByte (CP_ACP,NULL,text1,-1,text2,len,NULL,FALSE);
    SetDlgItemTextA(this->m_hWnd,IDC_TEXTOUT,text2);

    delete []text2;

 

windows核心编程随笔

标签:style   blog   color   ar   sp   div   art   log   bs   

原文地址:http://www.cnblogs.com/whypro/p/4067687.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!