PDA

View Full Version : Qprocess not working



bruccutler
14th February 2007, 23:09
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

jacek
14th February 2007, 23:15
What does QProcess::startDetached() return? Maybe you should create QCoreApplication instance before using QProcess?

bruccutler
15th February 2007, 03:20
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

bruccutler
15th February 2007, 04:48
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.