Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Self delete

Self delete

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
12 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    J_E_D_I
    wrote on last edited by
    #1

    Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running? Any advice please! jEDI

    T S J D R 5 Replies Last reply
    0
    • J J_E_D_I

      Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running? Any advice please! jEDI

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      actually, it can, as the program is loaded in memory when it runs...


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      J 1 Reply Last reply
      0
      • J J_E_D_I

        Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running? Any advice please! jEDI

        S Offline
        S Offline
        sunit5
        wrote on last edited by
        #3

        keep the track of all the files crested by ur application To kill ur exe use ExitProcess() when u dont require it

        never say die

        J 1 Reply Last reply
        0
        • T toxcct

          actually, it can, as the program is loaded in memory when it runs...


          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          J Offline
          J Offline
          jhwurmbach
          wrote on last edited by
          #4

          toxcct wrote:

          actually, it can

          Actually, no, as the exe is locked. Windows handles this different from Linux. ;)


          Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
          George Orwell, "Keep the Aspidistra Flying", Opening words

          1 Reply Last reply
          0
          • J J_E_D_I

            Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running? Any advice please! jEDI

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #5

            J_E_D_I wrote:

            I would now like to implement a sort of uninstall function

            Do you need an Installer? Try NSIS[^]. Its free.


            Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
            George Orwell, "Keep the Aspidistra Flying", Opening words

            T 1 Reply Last reply
            0
            • S sunit5

              keep the track of all the files crested by ur application To kill ur exe use ExitProcess() when u dont require it

              never say die

              J Offline
              J Offline
              J_E_D_I
              wrote on last edited by
              #6

              What's the syntax of ExitProcess()? Could you please make an example as if I wanted to delete a program called Program.exe Many thanks

              1 Reply Last reply
              0
              • J jhwurmbach

                J_E_D_I wrote:

                I would now like to implement a sort of uninstall function

                Do you need an Installer? Try NSIS[^]. Its free.


                Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                George Orwell, "Keep the Aspidistra Flying", Opening words

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                Inno Setup[^] ;P


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                J 1 Reply Last reply
                0
                • T toxcct

                  Inno Setup[^] ;P


                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  J Offline
                  J Offline
                  jhwurmbach
                  wrote on last edited by
                  #8

                  toxcct wrote:

                  Inno Setup

                  But that need scripting in Pascal! X| ;)


                  Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                  George Orwell, "Keep the Aspidistra Flying", Opening words

                  R 1 Reply Last reply
                  0
                  • J J_E_D_I

                    Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running? Any advice please! jEDI

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    J_E_D_I wrote:

                    ...including the application itself.

                    See here.


                    "A good athlete is the result of a good and worthy opponent." - David Crow

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    1 Reply Last reply
                    0
                    • J J_E_D_I

                      Hi I have developed a program in C++ and I would now like to implement a sort of uninstall function which will delete all the files created so far by the application, including the application itself. How can I do it, since the application can't delete itself if it is still running? Any advice please! jEDI

                      R Offline
                      R Offline
                      Russell
                      wrote on last edited by
                      #10

                      A simple way is use the key RunOnce on the windows registry to delete all files and directoryes. Also you can run a bat file that do this, or, of course, you can run an exe file to do this and delete it after that it ends. :cool:


                      Russell

                      R 1 Reply Last reply
                      0
                      • R Russell

                        A simple way is use the key RunOnce on the windows registry to delete all files and directoryes. Also you can run a bat file that do this, or, of course, you can run an exe file to do this and delete it after that it ends. :cool:


                        Russell

                        R Offline
                        R Offline
                        Russell
                        wrote on last edited by
                        #11

                        HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce


                        Russell

                        1 Reply Last reply
                        0
                        • J jhwurmbach

                          toxcct wrote:

                          Inno Setup

                          But that need scripting in Pascal! X| ;)


                          Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal.
                          George Orwell, "Keep the Aspidistra Flying", Opening words

                          R Offline
                          R Offline
                          Rage
                          wrote on last edited by
                          #12

                          jhwurmbach wrote:

                          But that need scripting in Pascal!

                          Oh come on, no install program is that complicated for you to not cope with Pascal for a few lines...

                          Don't follow any man spiritually, don't do anything that will get you in sh*t if god is real - Bradml[^]

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups