c – 无法将参数1从’const char [5]’转换为’LPCTSTR’
发布时间:2020-12-16 09:57:38 所属栏目:百科 来源:网络整理
导读:我正在使用此代码项目: http://www.codeproject.com/Articles/10138/Voice-Recording-Playing-back-using-simple-classes void CFisterDlg::OnRecord() { CString string; m_RecButton.GetWindowText(string); if(string == "Record") { StartRecordingToFi
我正在使用此代码项目:
http://www.codeproject.com/Articles/10138/Voice-Recording-Playing-back-using-simple-classes
void CFisterDlg::OnRecord() { CString string; m_RecButton.GetWindowText(string); if(string == "Record") { StartRecordingToFile(); m_RecButton.SetWindowText("Stop"); } else { StopRecordingToFile(); m_RecButton.SetWindowText("Record"); } } 但是我在很多地方都遇到了这个错误: error C2664: 'void CWnd::SetWindowTextW(LPCTSTR)' : cannot convert argument 1 from 'const char [5]' to 'LPCTSTR' 我认为这与我使用最新版本的visual studio(2013)有关. 解决方法
SetWindowTextW()接受字符串数据的字符指针,其中您的字符串数据由常规字符组成,但您的函数很可能需要一个unicode字符串,因此您无法直接输入字符串类型.你需要使用L“thisismystring”
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |