Methods of Qt calling external exe

Source: Internet
Author: User

To make a shortcut menu recently, you need to call an external. exe application.

When calling an external application, it is divided into blocking and non-blocking, which is non-blocking because of which program you want to invoke.

The method is as follows:

Using the Qprocess startdetached () method, the external program that is invoked can run as usual when the current program shuts down.

#include <QProcess> qprocess::startdetached ("E:\\qt\\qtcreator-2.4.1\\bin\\qtcreator.exe", Qstringlist ());

At this point the Windows system, so the path is using \ \.

Note that the parameters of the startdetached () function (see HTTP://QT-PROJECT.ORG/DOC/QT-4.8/QPROCESS.HTML#STARTDETACHED-2), the first argument is the external exe path, When the EXE path contains a space, you need to use the second parameter, if the external application only need EXE this one can be opened, the second argument written qstringlist () on it.

Other file paths are written into qstringlist () when an external application has an EXE that requires additional files to open. 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 as long as the previous EXE that is not open, you need to add a second parameter. Look at the properties of the Envi shortcut, and there are two files in the target file.

Reproduced from: http://www.cnblogs.com/Romi/archive/2012/05/03/2480374.html

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.