Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess: how to suppress the console window on windows?

QProcess: how to suppress the console window on windows?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Trino
    wrote on last edited by
    #1

    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.");
    messagewindow.exec();
    return;
    }
    @

    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?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Trino
        wrote on last edited by
        #3

        Thanks Chris for your quick and helpfull reply.

        This is a pitty for my project :-(

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved