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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Delete file at startup or shutdown

Delete file at startup or shutdown

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 6 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Hi, What I need to do is schedule some files to be deleted either at shutdown or at startup. My application can't do this because it is closing after it creates them and they need to remain there until shutdown. My app is currentlly creatting bat files for each of them and adds them to Startup folder in Start Menu. This method is inneficient though. For example how do uninstallers delete their executable at shutdown (startup)??? Thanks, Andrew

    T 1 Reply Last reply
    0
    • A Anonymous

      Hi, What I need to do is schedule some files to be deleted either at shutdown or at startup. My application can't do this because it is closing after it creates them and they need to remain there until shutdown. My app is currentlly creatting bat files for each of them and adds them to Startup folder in Start Menu. This method is inneficient though. For example how do uninstallers delete their executable at shutdown (startup)??? Thanks, Andrew

      T Offline
      T Offline
      tanvon malik
      wrote on last edited by
      #2

      you can run an application as windows starts up you make an entry in registry HKEY_LOCAL_MACHINE\Software\Microsoft\windows\CurrentVersion\Run in this key you make an entry and give your applications full path , this application now will run every time you start computer. Have a good luck.

      A 1 Reply Last reply
      0
      • T tanvon malik

        you can run an application as windows starts up you make an entry in registry HKEY_LOCAL_MACHINE\Software\Microsoft\windows\CurrentVersion\Run in this key you make an entry and give your applications full path , this application now will run every time you start computer. Have a good luck.

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        I can't use another app that deletes the files due to project specifications. I need somenthing more simple. I have been using bat files until now the console window showing at every startup was annoying. Is there a way to hide this window?? How do uninstallers delete their own bodies after uninstall??

        RaviBeeR M 2 Replies Last reply
        0
        • A Anonymous

          I can't use another app that deletes the files due to project specifications. I need somenthing more simple. I have been using bat files until now the console window showing at every startup was annoying. Is there a way to hide this window?? How do uninstallers delete their own bodies after uninstall??

          RaviBeeR Offline
          RaviBeeR Offline
          RaviBee
          wrote on last edited by
          #4

          Anonymous wrote: How do uninstallers delete their own bodies after uninstall?? See MoveFileEx()[^] /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

          1 Reply Last reply
          0
          • A Anonymous

            I can't use another app that deletes the files due to project specifications. I need somenthing more simple. I have been using bat files until now the console window showing at every startup was annoying. Is there a way to hide this window?? How do uninstallers delete their own bodies after uninstall??

            M Offline
            M Offline
            Max Santos
            wrote on last edited by
            #5

            Be carefull with the "MovefileEx" with the MOVEFILE_DELAY_UNTIL_REBOOT From MSDN: This value can be used only if the process is in the context of a user who belongs to the administrator group or the LocalSystem account.

            N 1 Reply Last reply
            0
            • M Max Santos

              Be carefull with the "MovefileEx" with the MOVEFILE_DELAY_UNTIL_REBOOT From MSDN: This value can be used only if the process is in the context of a user who belongs to the administrator group or the LocalSystem account.

              N Offline
              N Offline
              Nemok
              wrote on last edited by
              #6

              Thanks, guys it worked. Nemok

              T 1 Reply Last reply
              0
              • N Nemok

                Thanks, guys it worked. Nemok

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

                Remeber One thing MoveFileEx only Work In Windows Multiuser Editions,if you are targeting your application to Win98 then for deleting file at Startup you have to write the entry in the WinInet.ini It's an INI file, however for deleting it's harder because the format is: [rename] NUL=C:\\temp\\file1.exe NUL=C:\\foo\\file2.exe and so on. You can't use WritePrivateProfileString()because the second NUL line would replace the first. You need to read the whole file in,modify it, and write it back it again


                "I Think Believe this Will Help" [Vote One Here, Complete my Survey....]

                visit me at http://www.thisisalok.tk
                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