Results 1 to 11 of 11

Thread: QProcess

  1. #1
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess

    Hi all !

    I'm trying to launch a program (any... if only one function that will be nice )

    Qt Code:
    1. QProcess myprocess;
    2. myprocess.startDetached("cmd.exe");
    3. myprocess.waitForStarted(100000);
    4. QMessageBox::information(0,"","");
    To copy to clipboard, switch view to plain text mode 

    With this code I have directly the message box but I never saw the cmd.exe prompt (win xp)... what's going wrong please (I'm looking for hours...)

    Thanks !

    edit:

    I also tried this :
    Qt Code:
    1. QString sbrowser = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";
    2. QProcess pbrowser;
    3. qsl.push_back("http://www.google.com");
    4. int tmp = pbrowser.startDetached(sbrowser, qsl);
    To copy to clipboard, switch view to plain text mode 

    (of course it didn't work...)
    Last edited by agent007se; 22nd July 2006 at 22:56.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    Quote Originally Posted by agent007se
    myprocess.startDetached("cmd.exe");
    QProcess::startDetached() is a static method --- you invoke it without an object instance:
    Qt Code:
    1. QProcess::startDetached( "iexplore.exe", QStringList() << "http://www.google.com" );
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    True but that doesn't changed a lot of things but now I found this :

    QProcess::FailedToStart == pbrowser.error()

    with pbrowser.start(sbrowser, qsl); (instead of startDetached)

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    Try:
    Qt Code:
    1. QProcess::startDetached( "C:/Program Files/Internet Explorer/iexplore.exe", QStringList() << "http://www.google.com" );
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    valid instruction ! but don't work too :'(... that IS the problem...

    of course, the file exists (QFile::exists return true)
    Last edited by agent007se; 22nd July 2006 at 23:46.

  6. #6
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    I tried this too :

    Qt Code:
    1. QString sbrowser = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";
    2. QProcess *pbrowser = new QProcess();
    3. qsl.push_back("http://www.google.com");
    4. pbrowser->start(sbrowser, qsl);
    5. if(QProcess::FailedToStart == pbrowser->error()) QMessageBox::information(0,"", "1");
    6. else if(QProcess::Crashed == pbrowser->error()) QMessageBox::information(0,"", "2");
    7. else if(QProcess::Timedout == pbrowser->error()) QMessageBox::information(0,"", "3");
    8. else if(QProcess::WriteError == pbrowser->error()) QMessageBox::information(0,"", "4");
    9. else if(QProcess::ReadError == pbrowser->error()) QMessageBox::information(0,"", "5");
    10. else if(QProcess::UnknownError == pbrowser->error()) QMessageBox::information(0,"", "6");
    11. QProcess::startDetached(sbrowser, qsl);
    To copy to clipboard, switch view to plain text mode 

    nothing at all (the message box shows 1 and the doc says:
    The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.
    it exists ... and I'm with the admin account (the only account in my computer)

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    Does this work on your system?
    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QProcess>
    3.  
    4. int main( int argc, char **argv )
    5. {
    6. QCoreApplication app( argc, argv );
    7. QProcess::startDetached( "C:/Program Files/Internet Explorer/iexplore.exe", QStringList() << "http://www.google.com" );
    8. return 0;
    9. }
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    No and I just figured it out : KERIO (firewall)

    Is there equivalent functions that aren't blocked by firewalls and antivirus ??

    resolved : I cleared all my settings in kerio...
    Last edited by agent007se; 23rd July 2006 at 00:12.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    Quote Originally Posted by agent007se
    Is there equivalent functions that aren't blocked by firewalls and antivirus ??
    Won't such functions render them useless?

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess

    Quote Originally Posted by jacek
    Won't such functions render them useless?
    No, because only GoodPeopleTM can use them.

  11. #11
    Join Date
    Jun 2006
    Posts
    27
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess

    Quote Originally Posted by wysota
    No, because only GoodPeopleTM can use them.
    Lol. Very funny . I just cleared my settings so it was my fault and now it works pretty well .

Similar Threads

  1. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  2. QProcess +standard error + windows
    By antonio.r.tome in forum Qt Programming
    Replies: 0
    Last Post: 18th April 2006, 14:58
  3. QProcess start automaticaly needed application
    By raphaelf in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2006, 14:11
  4. speed up qprocess readstdout
    By kooshball in forum Qt Programming
    Replies: 1
    Last Post: 31st January 2006, 09:42
  5. QProcess in a QThread
    By chombium in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2006, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.