BSTR 转 QString
方法一:
QString Demo::bstrToqstring(BSTR bstr) { char buf[260] = { 0 }; int len = WideCharToMultiByte(CP_ACP, 0, bstr, wcslen(bstr), NULL, 0, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, bstr, wcslen(bstr), buf, len, NULL, NULL); return QString(buf); }
方法二:
// 获取并显示友好名称 WCHAR *aa = EloamGlobal_GetFriendlyName(1, 0); QString s = QString::fromWCharArray(aa);