Click to See Complete Forum and Search --> : An application that starts itself after existing


dit6a9
April 16th, 2005, 01:36 PM
I'm writing an application which needs to do some file operations, exist and the start again. The application must exist completely in order to free all the resources (files including itself, etc.) that it is using. How can I achieve this? How can I tell Windows, programatically, that the application must start again after existing completely?

Paul Rice
April 16th, 2005, 01:43 PM
This sounds dangerous. You should properly free any resources. Otherwise, you're just looking for memory leaks. To do anything else would be bad programming practice.

Don Reba
April 16th, 2005, 02:28 PM
You can write a small application that will wait for a process to terminate, then restart it and quit. This application can be then created from a resource and run before your main application exits. Simple enough.

SuperKoko
April 16th, 2005, 02:35 PM
You don't really need that the two processes of the same application never be launched at the same time.

You can call CreateProcess just before ExitProcess.