编译时出错:
error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [14]' to 'LPCTSTR'
error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [14]' to 'LPCTSTR'
用vc6编译正常
解决方法一:
出现的错误是c++工程默认的编码方式为UNICODE方式, 在使用字符串时必须将字符串转换为UNICODE方式,方法如下:
MessageBox(L"text");
或者
MessageBox(_T("text"));
在VC开发环境下,最好不要使用char数组,应该用TCHAR代替char
.net情况下不存在此问题
.net情况下不存在此问题
解决方法二: