VS2005编译器的检查更严格了,在vc6和vc7种可以编译通过的语句:AfxMessageBox(“test”);只能写成AfxMessageBox(_T(“test”));才能使用,否则编译器会告诉你有两个AfxMessageBox函数,但编译器不知道使用哪一个。错误提示如下:
error C2665: 'AfxMessageBox' : none of the 2 overloads could convert all the argument types
c:/program files/microsoft visual studio 8/vc/atlmfc/include/afxwin.h(5025): could be 'int AfxMessageBox(LPCTSTR,UINT,UINT)'
c:/program files/microsoft visual studio 8/vc/atlmfc/include/afxwin.h(5027): or 'int AfxMessageBox(UINT,UINT,UINT)'
while trying to match the argument list '(const char [22])'
因VS2005使用了宽字符,所以在前面加_T或L都行
MessageBox(_T("abcd"));或 MessageBox(L"abcd");
如果MessageBox用不了可以考虑用MessageBoxA