[error2664:Format(const wchar_t *,...)”:不能将参数 1 从“const char [4]”转换为“const wchar_t *”]的解决

void scesjk::OnBnClickedButton1()              //数据记录
{
    // TODO: 在此添加控件通知处理程序代码
    UpdateData(true);
    m_set.Open();
    m_set.AddNew();
    m_set.m_ID=biaoshiID;
    chubusheji4 *adlg=(chubusheji4 *)this ->GetParent();
    
    m_set.m_R1.Format(_T("%lf"),adlg->R1);
    m_set.m_R2.Format(_T("%lf"),adlg->R2);
    m_set.m_R3.Format(_T("%lf"),adlg->R3);
    m_set.m_w.Format(_T("%lf"),adlg->w);
    m_set.m_h.Format(_T("%lf"),adlg->h);
    m_set.m_h1.Format(_T("%lf"),adlg->h1);
    m_set.m_p.Format(_T("%lf"),adlg->p);

    m_set.Update();
    m_set.Close();


    UpdateData(false);
}

/////上述程序是正确的,项目的符号属于:多字符集

开始上述程序出现erroe2664的错误,是因为在头文件中定义的参数类型是CStringW,将其定义类型改成CString后,就不会出现3664的错误。

希望这个方法对大家有用。
 

猜你喜欢

转载自blog.csdn.net/weixin_42161647/article/details/83926387
今日推荐