windows核心编程随笔
2020-12-13 14:56
标签:style blog color ar sp div art log bs windows核心编程随笔 标签:style blog color ar sp div art log bs 原文地址:http://www.cnblogs.com/whypro/p/4067687.htmlMultiByteToWideChar(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;
上一篇:Java基础面试总结