解決方法:
使用用:wcscpy_s()方法。
extern "C" __declspec(dllexport)
void _methon1(char* inputHtml, LPWSTR lsb, char* HtmlNodeName, char* HtmlNodeAttributeName, char* HtmlNodeAttributeValue)
{
try
{
if (!IsLogin())
{
wstring ws = L"";
wcscpy_s(lsb, wcslen(ws.c_str()) + 1, ws.c_str());
return ;
}
MyHtml h;
string textStr = h.GetHtmlNodeInnerHtml(inputHtml, HtmlNodeName, HtmlNodeAttributeName, HtmlNodeAttributeValue);
//MessageBoxA(NULL, textStr.c_str(), "", MB_OK);
wstring ws = s2ws(textStr);//s2ws(textStr);;//L"中国伟大复兴梦";
//wstring ws = StringToWString(textStr);
wcscpy_s(lsb, wcslen(ws.c_str()) + 1, ws.c_str());
}
catch (const std::exception&)
{
}
}