views:

26

answers:

1

I have an app which acts almost like a daemon. Sometimes it quits on error and many times it prints an error msg then ask users to press any key to close.

How can i relaunch the app when either case happens? I am more interested in the 2nd case. I can do this in c++, C# or python. The script is an old python that i dont want to change (a newer c# version is in the works but not stable)

+1  A: 

You can look for the existing interface application at launch time and if found, send data to the exiting app to handle and exit. Otherwise handle the input data and then wait. The Microsoft.VisualBasic.ApplicationServices. WindowsFormsApplicationBase class uses IPC to pass data to the StartupNextInstance Event. You can certainly use other interprocess communication methods to communicate between different instances of your application.

Sheng Jiang 蒋晟