我用Visual c++ 2005
请问我在MFC application中用MessageBox("abc"),有错误
error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [4]' to 'LPCTSTR',
这是为什么?MessageBox()的后两参数不是缺省的吗?
请问我在MFC application中用MessageBox("abc"),有错误
error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [4]' to 'LPCTSTR',
这是为什么?MessageBox()的后两参数不是缺省的吗?
你说的后两个参数省略的 MessageBox,是CWnd::MessageBox,有3个参数,其中两个有缺省参数
int MessageBox( LPCTSTR lpszText, LPCTSTR lpszCaption = NULL, UINT nType = MB_OK );而全局的 MessageBox,有4个参数,而且没有缺省参数。
int MessageBox(
HWND hWnd, // handle of owner window
LPCTSTR lpText, // address of text in message box
LPCTSTR lpCaption, // address of title of message box
UINT uType // style of message box
);