感觉比较奇怪,下面代码是在网上的例子上修改的,结果正确,但不明白为什么。高手给讲下所以然。 CString strSource = _T("Hello");
wchar_t *temp;
CString strTemp;
USES_CONVERSION;
W2A(strSource.LockBuffer());
strSource.UnlockBuffer(); strTemp.Format(_T("%s"), temp);
AfxMessageBox(strTemp);
wchar_t *temp;
CString strTemp;
USES_CONVERSION;
W2A(strSource.LockBuffer());
strSource.UnlockBuffer(); strTemp.Format(_T("%s"), temp);
AfxMessageBox(strTemp);
解决方案 »
- 如何在CRichEditCtrl中使用CFindReplaceDialog实现查找替换?
- 非模态对话框中透明控件的显示问题
- 求救!!基于对话框的程序如何实现分页
- 请问:IDispatch error #3157是什么错误? ADO
- 散分,郁闷中
- 如何让mfc程序的窗口不能改变大小?
- 请教一个有关ListCtrl的问题
- ~~~~~~~~~~~~~~~做了一个控件,遇到一些小麻烦,是高手的进来看看~~~~~~~~~~~~~~
- 各位大哥,谁有在编程沙龙注册了的,请帮一个忙(急,在线)。如果成功,送全部分。
- 没什么分,但是问个问题
- 调试时,提示visa32.dll找不到是怎么回事?
- 怎么把完整的CMD脚本嵌入到VC程序中?
char *temp;
CString strTemp; /*USES_CONVERSION;
W2A(strSource.LockBuffer());
strSource.UnlockBuffer(); */strTemp.Format(_T("%s"), temp);
AfxMessageBox(strTemp);
http://www.cppblog.com/greatws/archive/2008/08/31/60546.html
WCHAR *tmp = NULL;
tmp = new WCHAR[nCount + 1];
int n = MultiByteToWideChar(CP_THREAD_ACP, 0, (LPCSTR)text, nCount, tmp, nCount);