Q: Restart an application

  • Thread starter Thread starter Visual Systems AB \(Martin Arvidsson\)
  • Start date Start date
V

Visual Systems AB \(Martin Arvidsson\)

Hi!

I have a windowsapplication, when the user modifies the .CONFIG file i want
to restart the application for the settings to take effect.

As far as i know, the settings are read when the application is started,
right?

So, how to terminate the application and then restart it?

Regards

Martin Arvidsson
 
I don't know if there's any way of doing this through the .Net framework...

you could just write a batch file that runs your application then deletes
itself, and then when you want to refresh the config, simply call this batch
file before closing your application down.
 
i suppose you could just call your application again use Process.Start
followed by a close on your current instance... These two obviously assume
you're not utilising Mutex in anyway.
 
Hi,

IIRC you cannot modify the config file while the application is running,
that's why you cannot modify its values at runtime

Frankly I dont know a sanctioned way of doing this, I can think of a couple
of ways but you will have to try it.

The calling appliaction should obtain a mutex, or could also be a temporary
file . It should be unique in the system though.
Then you start your new instance and pass the used unique item created
before, then the calling application start the shutdown, just before
shutdown it does release the mutex or delete the temp file.
This is the indication for the new instance to show itself.


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top