Windosw 编程中,LPCWSTR 变量和QT中最常用到QString相互转换:

1.把 LPWSTR 转换成QString
LPCWSTR str;
QString :: fromStdWString(str);

EG:
LPCWSTR lpcwStr;
QString str = QString::fromStdWString(lpcwStr);

2.把QString 转换成 LPWSTR
QString :: toStdWString();

EG:
QString args = QString::fromLocal8Bit("汉字2ABC");
std::wstring wlpstrstd = args.toStdWString();
LPCWSTR lpcwStr = wlpstrstd.c_str();

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-04
  • 2022-12-23
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案