本文共 838 字,大约阅读时间需要 2 分钟。
1. 不能从const char *(或者char数组)转换为LPCWSTR
a) 解决: _T("TEST"); b) 原因:在UNICODE(宽字节)字符集 typedef unsigned short wchar_t ,占2个字节;ANSI char 占一个字节;而系统默认使用UNICODE字符集 c) 参见http://blog.csdn.net/pirate97/article/details/6753763 2. 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用 a) 选择“项目->属性->配置属性->链接器->系统”,将/subsystem:console改为/subsystem:windows b) 控制台程序,它的入口函数是main;windows程序的入口函数为winmain; c) 参见http://blog.csdn.net/ldd901/article/details/5795799 3. MessageBox的使用 a) 新建的类如果是继承CWnd,或继承其他窗口类、控件类,总之是CWnd的子类的话,可以使用MessageBox(_T("连接成功"))的形式即单个参数; b) 其它情况,采用以下形式: int MessageBox( HWND hWnd, // handle to owner window LPCTSTR lpText, // text in message box LPCTSTR lpCaption, // message box title UINT uType // message box style ); --------------------- 作者:_北方的雪_ 来源:CSDN 原文:https://blog.csdn.net/wingofeagle/article/details/9043425 版权声明:本文为博主原创文章,转载请附上博文链接!