MFC工程从VC6.0转换成VS2013遇到的问题以及解决方法

1.没有与参数列表匹配的重载函数

使用_T。

例如:

m_edtSendData.SetWindowText(_T("Please enter a message content!"));

strSetting.Format(_T("%d%c%d%d"), rates[nRate], paritys[nParity], dataBits[nDataBit], stopBits[nStopBit]);

2.编译时候出现如下错
error C2440: 'static_cast' : cannot convert from 'void (__thiscall XXX::* )(void)' to 'void (__thiscall CWnd::* )(UINT_PTR)'只需要吧对应的事件响应函数声明与实现的部分,函数的参数由UINT改为UINT_PTR即可。

3.问题:不能将参数 1 从“const char [14]”转换为“const wchar_t *”

解决方法:m_strSQL.Format("book_name'%s'",m_strSeek);
修改为:
m_strSQL.Format(_T("book_name\'%s\'"),m_strSeek);
cstr.Format(_T("%s"),sctr1);这个函数还是很好用的。

4.“int strcmp(const char *,const char *)”: 无法将参数 1 从“CString”转换为“const char *”
这里面涉及到一个CString转换为const char *的问题,而且涉及到Unicode。

例子:
CString strTest = _T("abcd");
USES_CONVERSION;
LPSTR lpszTest = T2A(strTest);
lpszTest为被转换的字符串

5.warning C4996: 'CWinApp::Enable3dControls': CWinApp::Enable3dControls is no longer needed.

通常向导生成的代码是:
#ifdef _AFXDLL
    Enable3dControls();            // Call this when using MFC in a shared DLL
#else
    Enable3dControlsSt

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值