QFileInfo info("./records.db");
std::string str = info.absoluteFilePath().toStdString(); //将QString转换为string
std::wstring wstr(str.length(), L' ');  //初始化宽字节wstr
std::copy(str.begin(), str.end(), wstr.begin());  //将str复制到wstr
LPCWSTR path = wstr.c_str();  //将wstr转换为C字符串的指针,然后赋值给path

转换过程:QString->string->wstring->LPCWSTR

05-11 11:30