Source: http://www.cnblogs.com/Romi/archive/2012/05/03/2480374.html
When calling external applications, it is blocking and non-blocking. Here we use non-blocking, because the program that you want to call is called.
The method is as follows:
Use the startdetached () method of qprocess. When the current program is closed, the called external program can run as usual.
?
#include <QProcess> QProcess::startDetached( " E:\\Qt\\qtcreator-2.4.1\\bin\\qtcreator.exe" ,QStringList()); |
In Windows, the path is \\.
It should be noted that the parameters of the startdetached () function (see the http://qt-project.org/doc/qt-4.8/qprocess.html#startDetached-2), the first parameter is the external EXE path, when the EXE path contains spaces, you need to use the second parameter, if the external application only needs to open the EXE file, the second parameter can be written as qstringlist.
When an external application has an EXE file that requires other files to be opened, write other file Paths into qstringlist. For example, ENVI software:
QProcess::startDetached(tr("E:\\Study Program\\ITT\\IDL71\\bin\\bin.x86\\idlrt.exe"),QStringList("E:\\Study Program\\ITT\\IDL71\\lib\\hook\\envi.sav"));
If the previous EXE cannot be opened, you need to add the second parameter. Let's take a look at the attributes of the ENVI shortcut. The target file contains two files.