Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting external process in QT without command prompt in Windows

I'm try to start an external process in Qt with QProcess.startDetached(). I am able to successfully start the process, however when I do this I see an ugly Windows command prompt pop up. Is there any way to prevent this from happening?

like image 299
Jon Avatar asked Jan 30 '26 13:01

Jon


1 Answers

I use that method as well and do not have that problem. There are applications that create a command prompt when they are started. It may not be the Qt code that's at fault. You can validate that by setting up your code to start a different application and checking if it still creates a command prompt.

   QString program = "client.exe";
   QStringList arguments;

   ClientProcess = new QProcess( this );

   // exit calling application on called application start
   connect( ClientProcess, SIGNAL( started() ), this, SLOT( Exit() ) );
   // receive errors
   connect( ClientProcess, SIGNAL( error( QProcess::ProcessError ) ), this, SLOT( error( QProcess::ProcessError ) ) );

   ClientProcess->startDetached( program, arguments );
like image 90
Jay Avatar answered Feb 01 '26 09:02

Jay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!