hi to all, i am new to .Net Development. My requirement was executing an application whenever the service starts. i need to do it in C#. please help.i dont know how to do that . if u have any reference specify that also.
thanks in advance
hi to all, i am new to .Net Development. My requirement was executing an application whenever the service starts. i need to do it in C#. please help.i dont know how to do that . if u have any reference specify that also.
thanks in advance
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Scott LysleRank #49 · 31K reputationPosted Feb 12, 2008, 11:18 PM EST
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.