在进行菜单命令响应函数的实际练习的时候,在添加
MessageBox("MainFrame Clicked");
到OnProcess函数中时,出现了错误:
Error:argument of type "const char" is incompatible with parameter of type "LPCTSTR".
解决方法:
将命令改为:MessageBox(_T("MainFrame Clicked"));
原因:
问题是:无法将const char*转换成LPCTSTR
因为程序是在UNICODE 条件下运行的,当我调用MessageBox的时候,实际上调用的是MessageBoxW;
而 char 的UNICODE版被定义成这样:typedef unsigned short wchar_t ;占2个字节。
所以有字符做参数的函数相应也用两个版本了。