1
Answer

I want only one instance running of my application(exe)...

Photo of tank_sanju

tank_sanju

20y
1.9k
1
Hi, How can i determine any previous instance of the application, how close new instance and activate previous instance from new one? Anybody please help me... Thanks -Sanjay

Answers (1)

0
Photo of venkatesh p
NA 7 0 17y
thanks for your reply. i got it. but when i start the service "it shows some errors " please help me to rectify that. the errror was  service could not be started on this computer . since no timely fashion reply from service.
0
Photo of Scott Lysle
NA 28.5k 14.4m 17y
You can start by overriding the OnStart event for your service; in that code you can use Process.Start to kick on some other application (in the below example, I start internet explorer and pass it the URL for MSN as a argument so that whenever the service starts, it opens up MSN in an explorer window)
protected override void OnStart(string[] args) {  System.Diagnostics.Process.Start("iexplore.exe", "http://www.msn.com"); }   Process.Start accepts a couple of arguments, the first is the executable to launch (e.g., iexplore.exe in this example) and the second argument is any optional arguments that the executable may use (in this case, a URL).  Of course the executable can be any executable and may include a full path to that executable and the arguments to the executable are optional.