Please nominate your Qt Champions for 2021!

QProcess: show window of console application and get access to application status at the same time ?

  • Hello,
    I have to start a console application from my Qt application.
    Therefore I am using QProcess and start().
    The task manager shows me that the console application was started successfully. But no console is shown.
    I also tried it with startDetached(). Then the console is show, but then I am not able to get the status of the console application, because (as the function name says) it is detached from my Qt application.
    Can anyone tell me how I can start a console application with a shown console and have access to the status of the console application at the same time?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show the code where you use QProcess ? Also on which OS/Qt combo are you working ?

  • Hi,

    I am using Qt4.7.1 and I am working on Windows 7 64bit.

    // ...
    QString programAndArguments;
    programAndArguments += ""example.exe"";
    programAndArguments += " -x -y";

    QProcess *m_processAvrdude;
    m_processAvrdude = new QProcess(this);

    bool ret = m_processAvrdude->waitForStarted();
    if (ret == true)
    // ...

    And as I mentioned in my post before the process starts but the belonging console isn't shown.

  • Lifetime Qt Champion

    Pretty old version of Qt, are you locked to it ?

    Please take a look at QProcess's documentation to build the argument list

Log in to reply