i am working on an win mobile application . I am running application in background using
e.Cancle = true;
Now i need to relaunch same instance of that application so that i can off that application .
can any one tell me ... how to do this?
You need to:
1) Stop application(Kill process) http://msdn.microsoft.com/en-us/library/system.diagnostics.process.kill.aspx or Exit application http://msdn.microsoft.com/en-us/library/system.windows.forms.application.exit(v=vs.71).aspx
2) Run application again(Start process) http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start(v=vs.71).aspx
Also you may use Restart
method http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx
Which way you will choose depends no the your particular situation.
If the application needs to restart itself this may help you :
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx
You don't actually need to be running a winforms application for this to work - you just need to make sure the System.Windows.Forms DLL is present.
PS. i couldn't get this working for WPF - but I don't actually remember the exact reason right now
This might do it.
System.Diagnostics.Process.Start(Application.ExecutablePath);
Close();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.