1.strOut为输出参数 2.函数功能:输出nMaxLen个字符(包括中英文)比如:16个英文字符和16个中文字符。str为输入字符串 void CMainFrame::InterceptLenth(CString& str,int nMaxLen,CString& strOut) { int i= 0; int last = 0; char *s = str.GetBuffer(str.GetLength()); char *pre = s; while(i<nMaxLen) { char *next = (char*)CharNext(s); //保存下一个字符 int n = strlen(pre)-strlen(next); CString str1; str1= str.Mid(last,n); strOut += str1; last += n; s+=n; pre = next; i++; } }