Thread: How to self-delete program?

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    26

    Question How to self-delete program?

    Win32 project - VC++

    How can I self-delete program I run?

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Why would you?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by Elysia View Post
    Why would you?
    How does an uninstaller work?

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Dunno. Installers and uninstallers are so bloated these days you never know what's going on.
    But even so, knowing where it's going to be used can be used to suggest a better solution.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    26
    Elysia, I just need.

    Self-delete

    Like an unistaller

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Like an unistaller
    So create setup project in the VS and it will know how to install/uninstall application
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  7. #7
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    291
    On the catch22.net site there's an article about self deleting techniques and a sample c code for all windows selfdeleteing executables. On the codeproject.com site there's too an article with a sample. Maybe both will help you.

    Niara

  8. #8
    Registered User
    Join Date
    Mar 2008
    Posts
    26
    thanks Niara.

  9. #9
    Registered User
    Join Date
    Mar 2008
    Posts
    26
    What about using MoveFileEx? (I can wait for reboot)
    The problem with this is that I can't delete folder (where the program is located) because I have other files that need to be deleted as well,and MoveFileExcan't delete full folder.
    Do I need to use MoveFileEx on every file in my folder?

  10. #10
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    For what purpose? What have you tried already that didn't work?

  11. #11
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> How does an uninstaller work?

    by uninstalling *some other* program, of course.

    >> Installers and uninstallers are so bloated these days you never know what's going on.

    true, there are registry, service, even batch file entries (to name a few) to contend with these days. but the principal remains the same - remove a program and all (non-shared) registered components. moreover, I think that the OP may be talking about the questionable practice of having a program remove *itself* without any trace. there aren't a whole lot of legitimate reasons to do that, and I'm pretty sure that whoever ends up running the software won't appreciate knowing that such David Copperfield antics were amiss...

    use an uninstaller. it'ts that simple.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. delete and delete []
    By Lionel in forum C++ Programming
    Replies: 8
    Last Post: 05-19-2005, 01:52 PM
  2. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  3. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 09:48 AM
  4. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  5. questions about new and delete
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 09-07-2001, 01:48 PM