Results 1 to 3 of 3

Thread: QProcess with different versions of Qt

  1. #1
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Thanks
    35
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question QProcess with different versions of Qt

    My GUI app is running Qt 4.2.2 and as a last minute addition, the marketing dept wants a new feature. They want my program to start another program. Ordinarily this would not be a problem, but...

    In the QMainWindow constructor I want to start the other Qt GUI program. This other program is using a newer (unknown) version of Qt. I think this may be the problem.

    I try to invoke the program (which never starts) by:
    Qt Code:
    1. QString sFullPath( "C:\\Program Files\\Net3Helper\\Net3Helper.exe" );
    2. if ( !QProcess::startDetached( sFullPath ) )
    3. qDebug( "%s not started!", sFullPath.toAscii().data() );
    To copy to clipboard, switch view to plain text mode 
    If I change my file path string to...
    Qt Code:
    1. QString sFullPath( "C:\\WINDOWS\\System32\\calc.exe" );
    To copy to clipboard, switch view to plain text mode 
    ...the Windows calculator program starts as expected.

    I am working in MS Visual Studio 2005. The other apps directory contains the Qt DLLs required for its operation. Could it be that the 4.2.2 DLLs loaded for the main application are interfering with the ones in the Net3Helper directory?

    If so, is there a solution to this problem other than having both applications use the same version of Qt? This is not possible as the program must be done within the next 2 weeks!

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess with different versions of Qt

    Weird...
    What happens if you create a batch file for starting the second program, and execute the batch file with QProcess? The usual way is to pass the batch file as parameter to cmd.exe.

    EDIT: perhaps there's a problem with spaces in the path. Can you try with:
    Qt Code:
    1. QString sFullPath( "C:\\Progra~1\\Net3Helper\\Net3Helper.exe" );
    To copy to clipboard, switch view to plain text mode 
    ?

  3. #3
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Thanks
    35
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QProcess with different versions of Qt

    The problem is Windows (and a programmer with a short memory), isn't that most always the case? Since the full path contained a space in it, there needed to be quotes around it before the system would understand it.

    Not:
    Qt Code:
    1. QString sFullPath( "C:\\Program Files\\Net3Helper\\Net3Helper.exe" );
    2. QProcess::startDetached( sFullPath );
    To copy to clipboard, switch view to plain text mode 
    but,
    Qt Code:
    1. QString sFullPath( "\"C:\\Program Files\\Net3Helper\\Net3Helper.exe\"" );
    2. QProcess::startDetached( sFullPath );
    To copy to clipboard, switch view to plain text mode 
    Thanks for looking at this Marcel!

Similar Threads

  1. Questions about kill() and start() of QProcess
    By mp33919 in forum Qt Programming
    Replies: 5
    Last Post: 23rd June 2007, 13:00
  2. QProcess and Pipes
    By KaptainKarl in forum Qt Programming
    Replies: 1
    Last Post: 9th April 2007, 23:11
  3. QProcess extremely slow on Windows?
    By Pepe in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2007, 00:25
  4. problem with qprocess
    By deekayt in forum Qt Programming
    Replies: 2
    Last Post: 13th June 2006, 13:30
  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.