CString->TCHAR*的转化可以用函数GetBuffer()

// 原型:LPTSTR GetBuffer( int nMinBufLength );
CString str(_T("Michael Joessy"));
const TCHAR* pszMsg = str.GetBuffer(str.GetLength());
str.ReleaseBuffer();

注意:GetBuffer后一定记得ReleaseBuffer。

TCHAR*->CString的转化

TCHAR szTchar[] = L"Michael Joessy";
CString str;
str.Format(_T("%s"), szTchar);
05-22 23:14