please i do need some help with this. I have this function,
void CtestDlg::OnClickedIdhello()
{
// TODO: Add your control notification handler code here
MessageBox("Hello. This is my first visual C++ Application!");
}
and when i build the program i get this error:
Error 1 error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [48]' to 'LPCTSTR' c:\documents and settings\kokolade\desktop\my_test\test\test\testdlg.cpp 160 1 test
i will be glad if someone can point me in the right direction
thanks
Sorry, but wrong. In Disch's words: There are 3 message box functions: MessageBoxA, MessageBoxW, and MessageBox, and they all take 3 different types of string datatypes.
-MessageBox: Takes LPCTSTR, which is a pointer to const TCHAR.
-MessageBoxA: Takes LPCSTR, which is a pointer to const char.
-MessageBoxW: Takes LPCWSTR, which is a pointer to const wchar_t.
Therefore, saying "Use MessageBox() with a const wide char string" is just wrong. You can do either of the following:
Any other combination is just wrong in Disch's eyes. In mine kind of. I would accept MessageBox(L"Hello", ...); if surrounded by #ifdef _UNICODE ... #endif .