获取汉字的ASCII码,完成VB的Asc函数功能

前端之家收集整理的这篇文章主要介绍了获取汉字的ASCII码,完成VB的Asc函数功能前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

static INT_PTR StatusName(CString csTxt)
{
CString csTemp;
csTemp = csTxt;
char * pchar = new char [csTemp.GetLength()*2 + 1];
memset(pchar,csTemp.GetLength()*2+ 1);
WideCharToMultiByte( CP_ACP,csTemp,-1,pchar,csTemp.GetLength()*2 + 1,NULL,NULL );
unsigned char buf1[2];
buf1[0] = pchar[1];
buf1[1] = pchar[0];
shortiAsccii = 0;
memcpy(&brt,buf1,2);
delete [] pchar;
pchar = NULL;
return (INT_PTR)iAsccii;
}

测试环境:VC2010

原文链接:https://www.f2er.com/vb/257560.html

猜你在找的VB相关文章