Results 1 to 3 of 3

Thread: problem about QProcess:: startDetached

  1. #1
    Join Date
    Apr 2012
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question problem about QProcess:: startDetached

    Hi,
    I want to start a bat shell on Windows XP, and I use QProcess::startDetached() function to start the bat shell.

    bool QProcess::startDetached ( const QString & program, const QStringList & arguments, const QString & workingDirectory, qint64 * pid = 0 )

    If the first parameter is setted to a absolutely path, everything is ok. But if the first paramter is setted to a relative path, the shell(console) just flash across and the process started failed.

    Then, I try to add "PAUSE" to the bat shell, but it dosen't pause.
    Then, I think that Maybe the startDetached function dosen't get the correct path. But if I remove the bat shell file, there is nothing happen, so I think QProcess::startDetached function is sure to get the bat shell file, it just cannot start the bat shell successfully.

    Anyone know what's the problem?
    Thankyou very much

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: problem about QProcess:: startDetached

    Using a relative path for the command to run will look for the specified program in the current working directory of the launching process first, which is probably not where you think it is, then the system PATH. If the program is not found in either place then it will fail.

  3. #3
    Join Date
    Oct 2009
    Posts
    483
    Thanked 97 Times in 94 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: problem about QProcess:: startDetached

    You forgot in your post to tell us what value was returned by QProcess::startDetached().

Similar Threads

  1. Replies: 1
    Last Post: 19th August 2012, 17:08
  2. QProcess::startDetached and UAC on Vista
    By serious_jack in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2011, 06:13
  3. Replies: 0
    Last Post: 24th November 2010, 11:11
  4. QProcess::startDetached fails on Mac
    By sgmurphy19 in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2008, 09:26
  5. QProcess-startDetached and Console screen problem
    By ramazangirgin in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2008, 08:05

Tags for this Thread

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.