How could i develop a running-once application
-
Hi, How can i develop a application which can execute once and the executive file would be removed from device. Like: After program show a message, this executive file is removed. I got a straight way that after the application executes, deleting this application file. But how? Running program couldn't delete itself. Any suggestion is welcome. Thanks! Regards, ginee
-
Hi, How can i develop a application which can execute once and the executive file would be removed from device. Like: After program show a message, this executive file is removed. I got a straight way that after the application executes, deleting this application file. But how? Running program couldn't delete itself. Any suggestion is welcome. Thanks! Regards, ginee
Hi! I don't think that it is possible to delete a program that's running, but you could add an entry to
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
to delete the file at the next system start. Regards, mav -
Hi, How can i develop a application which can execute once and the executive file would be removed from device. Like: After program show a message, this executive file is removed. I got a straight way that after the application executes, deleting this application file. But how? Running program couldn't delete itself. Any suggestion is welcome. Thanks! Regards, ginee
You can't delete the .EXE file if it's running, or any of it's loaded .DLL's for that matter. Your app would have to launch an external process, that handles changing out the executable you want to replace, then quit. This external process (.EXE) would have to wait for the original app to quit, then it could change out any of the files that it needs to upgrade or modify, then when done, launch the original app, then quit. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Hi, How can i develop a application which can execute once and the executive file would be removed from device. Like: After program show a message, this executive file is removed. I got a straight way that after the application executes, deleting this application file. But how? Running program couldn't delete itself. Any suggestion is welcome. Thanks! Regards, ginee
A simple solution would be to use a batch file (.bat) to run your application. You could run the executable from within the batch file and when you have exited the main application it could delete the executable. I use something like the following to quickly write a test sample, compile it, run it and then delete it when the app is done:
csc /target:winexe test.cs
pause
test.exe
del test.exe- Nick Parker
My Blog | My Articles