QProcess: how to suppress the console window on windows?

  • Hello all,

    I use the following code to start an external mediaplayer and control it (for pause/start/stop):

    @ video_process = new QProcess(this);

    QStringList arguments;
    arguments << "--video-on-top" << "-I" << "rc";

    video_process->start("vlc", arguments);

    if(video_process->waitForStarted(5000) == false)
    QMessageBox messagewindow(QMessageBox::Critical, "Error", "Unable to start VLC mediaplayer.\n"
    "Check your installation of VLC.\n"
    "Also, check if VLC is present in the PATH evironment variable.");

    It works great on Linux and it's exactly what I need. I can load, start, stop and pause media and get info about the position (time left).

    The problem is, it does not work on Windows. When I run this code, for some strange reason Windows opens a console.
    This creates two problems:

    1. It's ugly to see another unused window.
    2. More urgent, the responses of my commands will end up in the console window instead of my application, so communication is lost :-(

    My question is, how do I use QProcess on windows without opening a console window?

  • Moderators

    Exactly as you did.

    Unfortunately see what happens when you run this command in the windows command prompt - yup, it opens another one. It seems that vlc on Windows is just built that way (a very not nice way that is), but it's not a problem with Qt or QProcess.

  • Thanks Chris for your quick and helpfull reply.

    This is a pitty for my project :-(

  • Moderators

    Maybe there's a Windows specific switch or something. Try asking on the "vlc forum":https://forum.videolan.org/

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.