How to run a console program "silently"?
When running a console program through QProcess in a GUI app, you normally expect that nothing pops up and that all output can be smoothly parsed by your app for the confort of the user. unfortunately this is only partly working... When running a console app under windows (9x/ME series at least, I didn't tested under XP) an ugly console windows appears, even if all output is redirected by QProcess. Having used a bunch of apps running console process without seing this console windows appearing I know that what I'm trying to achieve is possible but I don't know how... Source code of other apps, such as Code::Blocks or Dev-Cpp doesn't help much( C::B is written with wxWindows and Dev-Cpp is written in Delphi)...
Any hints ?
Re: How to run a console program "silently"?
How do you start that external application? Maybe you start it through cmd.exe?
Re: How to run a console program "silently"?
Nop!
I start them through a QProcess object, and not QProcess::startDetached(), itself owned by a running non-GUI QThread.
Re: How to run a console program "silently"?
I've created a small test:
Code:
#include <QApplication>
#include <QProcess>
#include <QMessageBox>
#include <QString>
int main( int argc, char **argv )
{
proc.start("g++ --version");
proc.waitForFinished();
QString output
( proc.
readAllStandardOutput() );
return 0;
}
and it doesn't open console window. Maybe this is because you start QProcess in another thread?
Re: How to run a console program "silently"?
This does not work...
Mmmh, yes it does work but the console windows still appears... It must be specific to Win 9x/ME ...
Re: How to run a console program "silently"?
Quote:
Originally Posted by fullmetalcoder
It must be specific to Win 9x/ME ...
It could be, I've tested above program on windows XP.
Re: How to run a console program "silently"?
win9x/ME ??? I thought they died quite a while ago....
Re: How to run a console program "silently"?
do you? You were wrong then... There at least on winME still running on that good old Earth! :)
But is that the point anyway?
Re: How to run a console program "silently"?
"Good old earth"? Isn't WinME famous of it's memory leaks and stuff. I thought it's maybe the worst Windows ever.. :p
Re: How to run a console program "silently"?
It certainly is a great piece of Window$-coding with all the bugs and leaks it implies... AFAI Used it it crashes 1 time over 3 at run-time!!! Impressive, huh?:D Tha's why I'm using Fedora most of the time, but as it is the only Window$ I've got I use it to test my code so...