想要使用Qt的QProcess类启动一个程序,如IE,于是尝试使用如下程序:

QProcess *qp = new QProcess();
qp->start("C:\\Program Files\\Internet Explorer\\iexplore.exe");

结果无法启动IE程序。

Note: Arguments that contain spaces are not passed to the process as separate arguments.

原来完整的路径中不能出现空格的,否则认为空格是分隔多个程序的,也就不能正确的启动IE了。

QProcess *qp = new QProcess();
 
QDir::setCurrent("C:\\Program Files\\Internet Explorer"); 
qp->start("iexplore.exe");

 

 

posted on 2013-06-18 09:03  dawnhunter  阅读(456)  评论(0编辑  收藏  举报