Click to See Complete Forum and Search --> : how to delete running file


Yuri Tkachov
June 4th, 1999, 01:52 PM
Hi,

I am developing simple setup/uninstall program for my own needs. The question is: when my uninstaller runs how can I delete the uninstaller iself?

ric
June 5th, 1999, 06:57 AM
As far as understand of MS Windows no one can delete a running program. Otherwise we all shall be overriding functions like this:
OnPervertDeletingYourRunningProgram(MSG* pMsg)
{
AfxMessageBox("Please, pervert, do not kill my program, it is still running!");
}

But why dont you try this, create another process with a different context, stack, heap, no parent and what ever else you can think of, then close your app and delete it from the process. Once I have a similar problem in a program, but luckly the program was discarded before to be implemented and I never has the chance to try this. So now this is your chance. I will appreciate an answer whether it works or not.

Yuri Tkachov
June 7th, 1999, 08:23 PM
There is exhaustive article on the theme. You can find it on http://msdn.microsoft.com/library/periodic/period96/periodic/msj/F1/D2/SF9C.htm