C++ 无法将参数1从“const char*”转换为“const wchar\u t*”
这里我分配Cstring.Format。有没有办法改变信仰?当我使用它时,我得到以下错误C++ 无法将参数1从“const char*”转换为“const wchar\u t*”,c++,C++,这里我分配Cstring.Format。有没有办法改变信仰?当我使用它时,我得到以下错误 void Cchart_event_07Dlg::OnMouseDownClientserver1(LPDISPATCH sender, LPDISPATCH args) { /*This Event will display a MessageBox with the series and point information, as well as the XY coordinates.
void Cchart_event_07Dlg::OnMouseDownClientserver1(LPDISPATCH sender, LPDISPATCH args)
{
/*This Event will display a MessageBox with the series and point information, as well as the XY coordinates.
This is done when clicking anywhere in the Chart control. */
Cfx62::_MouseEventArgsXPtr myArgs = (Cfx62::_MouseEventArgsXPtr)args;
int x = myArgs->X;
int y = myArgs->Y;
int pointVal = myArgs->Point + 1;
int series = myArgs->Series + 1;
CString strTemp;
enum Cfx62::HitType _result;
HRESULT _hr = myArgs->get_HitType(&_result);
if (_result == Cfx62::HitType_Point)
{
strTemp.Format("Series: %d, Point: %d, X: %d, Y: %d", series, pointVal, x, y);
MessageBox(strTemp, NULL, MB_OK);
}
UpdateData(true);
}
只需在字符串常量之前添加L,将其标记为宽字符串:
strTemp.Format(L"Series: %d, Point: %d, X: %d, Y: %d", series, pointVal, x, y);
只需在字符串常量之前添加L,将其标记为宽字符串:
strTemp.Format(L"Series: %d, Point: %d, X: %d, Y: %d", series, pointVal, x, y);
CString::Format的第一个参数不是char*。请阅读文档并查看此处我分配的Cstring.Format。-不,您不是。CString::Format的第一个参数不是char*。请阅读文档并查看此处我分配的Cstring.Format。-不,你不是。