DeleteFile Function question
-
I'm using the DeleteFile Function in an attempt to delete the program that is running. How can a program delete itself? I tried renaming the executable before deleting it, and it does is rename it but doesn't delete it. I suspect you can't delete an open file or program in NT, but I'm sure someone here has found a way to make a program delete itself aka uninstaller.. Any help would be thouroughly appreciated. Thanks in advance friends!
-
I'm using the DeleteFile Function in an attempt to delete the program that is running. How can a program delete itself? I tried renaming the executable before deleting it, and it does is rename it but doesn't delete it. I suspect you can't delete an open file or program in NT, but I'm sure someone here has found a way to make a program delete itself aka uninstaller.. Any help would be thouroughly appreciated. Thanks in advance friends!
The easiest way is to create a batch file (.bat), from your program, start the batch file and exit your program. In the batch file you loop until you can delete the programfile, and you delete the batch file (it can delete itself, a running program can not) - Anders Money talks, but all mine ever says is "Goodbye!"
-
I'm using the DeleteFile Function in an attempt to delete the program that is running. How can a program delete itself? I tried renaming the executable before deleting it, and it does is rename it but doesn't delete it. I suspect you can't delete an open file or program in NT, but I'm sure someone here has found a way to make a program delete itself aka uninstaller.. Any help would be thouroughly appreciated. Thanks in advance friends!
Hi Martin Use MoveFileEx with the MOVEFILE_DELAY_UNTIL_REBOOT flag Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]