[Interest] QProcess to start a process at a higher priority

Jason Kretzer Jason at gocodigo.com
Mon Mar 9 00:53:59 CET 2015


Hello all,

I am tinkering a bit with QProcess on Windows7.  What I would like to be able to do is to start a process with a “high” priority.  My application spawns multiple processes and I am tinkering with them in order to help ensure they get their processor time.

On the command line, I would do this.

start /high myspawn.exe arg1 arg2 arg3

Unfortunately one of the requirements is that a DOS window not open to run it.

If I start the process like this:

QString program = “myspawn.exe";
QStringList arguments;

arguments << “arg1” << “arg2" << “arg3";

QProcess *p = new QProcess(this);
QTimer::singleShot(30000, this, SLOT(deleteLater()));
qDebug() << "starting mysawn process -- " << p->startDetached(program, arguments);

It starts just fine, no DOS window, but at Normal priority.

I have tried multiple ways using the “start /high…” command inside of the various ways to execute a command with QProcess, but they always flash a DOS window.

I even create a .bat file with the command in it and passed arguments in with the above code.  While it worked, it flashed the DOS window.

Am I missing something here?

-Jason

//------------------------------//
   Jason R. Kretzer
   Lead Application Developer
   Jason at gocodigo.com<mailto:Jason at gocodigo.com>
//-----------------------------//

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150308/e6bf855f/attachment.html>


More information about the Interest mailing list