Re: How to start another program in Windows Service?
- From: "Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
- Date: Mon, 18 Apr 2005 16:01:16 -0400
Hi,
The problem you have is that notepad is an interactive program,.the service
do not have a "display" where to show the notepad window, remember that the
service is running even if nobody is logged on the computer
The same thing happen when you are starting the service, if you have it
declared as "automatic" it's started when windows is starting, at that
moment you still have the windows startup screen.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Dao" <hungtdao@xxxxxxxxx> wrote in message
news:c190ca3d-dd4a-41ae-9768-56c2bb3df818@xxxxxxxxxxxxxxxxxxxxxxx
>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
.
- References:
- Prev by Date: Re: How can I determine the name of a new object or variable at ru
- Next by Date: Re: How to start another program in Windows Service?
- Previous by thread: Re: How to start another program in Windows Service?
- Index(es):
Relevant Pages
|