Results 1 to 8 of 8

Thread: Problem with QProcess when execute different kind of .exe files

  1. #1
    Join Date
    Jul 2012
    Posts
    12
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Post Problem with QProcess when execute different kind of .exe files

    Hi there,

    I have encountered a QProcess problem when I trying to call QProcess::start().There is my source code:
    Qt Code:
    1. QProcess * process=new QProcess(this);
    2. QString temp="\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\"";
    3. process->startDetached(temp);
    To copy to clipboard, switch view to plain text mode 
    My project is simple,I just want to open another application(*.exe) after I clicked the button on my current ui.This project works well,but when I replace the iexplore.exe with other Qt compiled execute file,It would not work any more.
    Like this one:
    Qt Code:
    1. QProcess * process=new QProcess(this);
    2. QString temp="\"E:\\QTProject\\openExe\\xmltest.exe\"";
    3. process->startDetached(temp);
    To copy to clipboard, switch view to plain text mode 
    I supervise the process->state() and it printed "2" which means the process had been already running,but there is nothing happend,just like I didn't do a thing. And all *.exe file, including xmltest.exe , I have tested are all compiled by Qt.4.8.
    Has anyone known it about?Please help.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    Does E:\\QTProject\\openExe\\xmltest.exe\ runs when you double click it?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jul 2012
    Posts
    12
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    yeah,sure it's running.And I have tested all Qt compiled execute files ,did not work.But other .exe files did.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    yeah,sure it's running.
    Nothing is sure and there is a good reason I asked.
    My guess is that you have problem with your environment and that your exe can't find the Qt dlls when you start it in your QProcess.
    Try this:
    QProcessEnvironment
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. The following user says thank you to high_flyer for this useful post:

    wolfguolei (9th July 2012)

  6. #5
    Join Date
    Jul 2012
    Posts
    12
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    Thanks for your tips man.
    Can you tell me how to use it,or give me a example depend on this
    Qt Code:
    1. QProcess * process=new QProcess(this);
    2. QString temp="\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\"";
    3. process->startDetached(temp);
    To copy to clipboard, switch view to plain text mode 

    thanks very much

  7. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    Can you tell me how to use it
    Not better than the docs can.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #7
    Join Date
    Jul 2012
    Posts
    12
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    Thank you all the same, though I still can't understand it...

  9. #8
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QProcess when execute different kind of .exe files

    If you be more specific about what it is you don't understand (best would be a description of what you have tried) maybe I can help you more.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 1
    Last Post: 18th May 2011, 17:18
  2. QProcess does not execute Automator app in OSX 10.6
    By Markus in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2010, 04:12
  3. How to use the QProcess to execute the Browser ?
    By eric0214 in forum Qt for Embedded and Mobile
    Replies: 7
    Last Post: 21st December 2009, 10:06
  4. How to use the QProcess to execute the Browser ?
    By eric0214 in forum Qt Programming
    Replies: 2
    Last Post: 17th November 2009, 06:18
  5. Replies: 1
    Last Post: 21st August 2009, 07:10

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.