开发者

Qt - QProcess is not working

I try to launch internet explorer, So I use the below code

QProcess * proc开发者_运维百科ess=new QProcess(this);
QString temp="C:\\Program Files\\Internet\ Explorer\\iexplore.exe";
process->startDetached(temp.toStdString().c_str());

But it doesn't work.


Try:

QProcess * process=new QProcess(this);
QString temp="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"";
process->startDetached(temp);

You need to use escaped quotes since the path has a space in it, or possibly escape all the spaces (you missed Program\ Files in the code you posted).


How about that?

QDir dir("C:\\");
QProcess::execute("explorer.exe", QStringList() << dir.toNativeSeparators(dir.path()));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜