Results 1 to 4 of 4

Thread: Qprocess not working

  1. #1
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Qprocess not working

    Hello,
    I'm obviously missing something. I'm trying to learn QProcess and it's not working.

    I'm running on Windows Xp.

    Here is my program:

    #include <Qtcore>

    int main()
    {
    QString x = "C:/Program Files/Windows NT/Accessories/WORDPAD.EXE";
    QProcess::startDetached(x);
    }

    I've also tried:
    QString x = "C:\\Program Files\\Windows NT\\Accessories\\WORDPAD.EXE";

    Doesn't work either. Simple, right? So, what am I missing? I can't seem to launch any other program either.

    I can run this same program from the command prompt.

    - Bruce

  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 not working

    What does QProcess::startDetached() return? Maybe you should create QCoreApplication instance before using QProcess?

  3. #3
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Re: Qprocess not working

    I'm not sure whether this is related or not, but when I press F10 within the MSVC developer studio, it comes up with a message "This application has failed to start because QtGuid4.dll was not found. Re-installing the application may fix this problem."

    But when I press F5 and run it to a breakpoint, it works.

    - Bc

  4. #4
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Talking Re: Qprocess not working

    I figured out my own problem. In case someone else looks up this thread, you can't set a path in the input variable. It can only be a file NAME! No path. You must set the SetWorkingDirectory to the location of the executable and then call the start() with just the file name.

    This is more of a Linux-ism.

Similar Threads

  1. QProcess not working in some cases
    By munna in forum Qt Programming
    Replies: 1
    Last Post: 1st August 2006, 09:58
  2. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  3. QProcess / system call not working under linux. Why?
    By johnny_sparx in forum Qt Programming
    Replies: 12
    Last Post: 11th March 2006, 00:32
  4. Qprocess
    By ioannisb in forum Qt Programming
    Replies: 5
    Last Post: 13th February 2006, 08:38
  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.