Results 1 to 3 of 3

Thread: How can I delete program using QProcess?

  1. #1

    Question How can I delete program using QProcess?

    Hello guys

    I'd like to delete program using QProcess.

    My code "pp.exe"
    //////////////////////////
    QProcess *pro = new QProcess(0); //

    connect( pro, SIGNAL(started()), this, SLOT(slotStart()) ); // 연결해서
    ...
    void slotStart() { close(); }
    ...
    pro->start("tt.exe");

    /////////////////////////////////

    so, i made "tt.exe" for deleting pp.exe file.

    you know this can not use it because of instance.

    then how should i solve it?


    thanks for watching.

    .

  2. #2
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I delete program using QProcess?

    I had a similar problem some days ago (http://www.qtcentre.org/forum/f-qt-p...ess-23571.html).
    I wanted to write an update routine for an application. A second executable should do the job.
    The "update application" signals the real application via a flag in a QSharedMemory that it has to exit. Then the original exe can be deleted an be replaced by the newer exe.

    The update exe is called via QProcess::startDetached() so that it is really a completely independent process.
    When the "Start Update" button is clicked in the update exe it sets the falg to true.
    After starting the update exe the real application waits for the flag in the shared memory to become "true" then it simply calls qApp->quit().
    The update exe can now call QFile::remove(...) to delete the original exe and QFile::copy(...) to get the newer exe from our intranet.

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can I delete program using QProcess?

    another way for updater is to change the architecture of your app: Make almost every part of your app a plugin, and let the .exe just load these plugins. Than the exe would not need any updates, and it can check for plugin updates before loading them so there would no problem with deleting/replacing them.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

Similar Threads

  1. Qprocess for a prompted program
    By muzgash in forum Qt Programming
    Replies: 4
    Last Post: 13th June 2012, 19:18
  2. Replies: 1
    Last Post: 1st December 2008, 21:02
  3. QProcess start a console program
    By Shawn in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2007, 12:38
  4. QProcess problem (Main program hangs)
    By sincnarf in forum Qt Programming
    Replies: 5
    Last Post: 11th October 2007, 09:26
  5. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19

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.