How to call external EXE using QT in Windows

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.