D
Dao
I have created a windows service called MyService. I followed the MSDN sample code to add the following code but it did not work. What I tried was that to start another or external program when MyService starts. I used notepad.exe as an example of a program to be called when MyService starts. I have tried both in the InitializationComponenet() then in the OnStart() Method but none of them work. Any help would be appreciated.
private void InitializeComponent()
{
this.process1 = new System.Diagnostics.Process();
//
// process1
//
this.process1.StartInfo.FileName = "c:\\WINDOWS\\notepad.exe";
this.ServiceName = "MyService";
}
I also tried this:
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "c:\\windows\\notepad.exe";
}
From http://www.developmentnow.com/g/36_2005_4_0_17_0/dotnet-languages-csharp.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
private void InitializeComponent()
{
this.process1 = new System.Diagnostics.Process();
//
// process1
//
this.process1.StartInfo.FileName = "c:\\WINDOWS\\notepad.exe";
this.ServiceName = "MyService";
}
I also tried this:
protected override void OnStart(string[] args)
{
// TODO: Add code here to start your service.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "c:\\windows\\notepad.exe";
}
From http://www.developmentnow.com/g/36_2005_4_0_17_0/dotnet-languages-csharp.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com