How to self-delete program?

This is a discussion on How to self-delete program? within the Windows Programming forums, part of the Platform Specific Boards category; Win32 project - VC++ How can I self-delete program I run?...

  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
    Posts
    22,828
    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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,252
    Quote Originally Posted by Elysia View Post
    Why would you?
    How does an uninstaller work?

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,828
    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
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    Like an unistaller
    So create setup project in the VS and it will know how to install/uninstall application
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  7. #7
    Registered User
    Join Date
    Mar 2005
    Location
    Juneda
    Posts
    287
    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,189
    For what purpose? What have you tried already that didn't work?
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  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, 01:46 PM
  3. insufficient memory for tsr
    By manmohan in forum C Programming
    Replies: 8
    Last Post: 01-02-2004, 08:48 AM
  4. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 04:23 PM
  5. questions about new and delete
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 09-07-2001, 01:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21