Sorry, I had not viewed your actual code. You should not be opening the form
as if you are starting a new application, but rather create an instance and
show it.
protected override void OnStart(string[] args)
{
// Application.EnableVisualStyles();
// Application.SetCompatibleTextRenderingDefault(false);
// Application.Run(new Form2());
Form2 f2 = new Form2();
f2.show();
eventLog1.WriteEntry("Start DONE.");
}
[quoted text, click to view] "Andrew" wrote:
> Thanks.
> I've enabled that, but when I attempt to Start the service, the progress bar
> just goes slowly and never reaches the end til I get an error message about
> Timing out.
>
> Windows is attempting to start the following service on Local Computer
> MyNewService4.
>
> I've tried adding :
>
> Thread.Sleep(1000);
>
> However, I never see Form2. Any suggestions ?
>
> cheers
> Andrew
>
> "Family Tree Mike" wrote:
>
> > You should not have a user interface from within a service. The service
> > typically runs with no desktop on which to display the interface. If
> > neccessary you will want an external application run by the user to
> > communicate with the service.
> >
> > That said, on XP, you may enable desktop interaction as a setting on the
> > service.
> >
> >
> >
> > "Andrew" wrote:
> >
> > > Windows services opens a win application form.
> > >
> > > Hi,
> > > How do I get my Windows service opens form in windows application ?
> > >
> > > I have this bit of code :
> > >
> > > Service1.cs
> > > ===========
> > > using System.Windows.Forms;
> > >
> > > protected override void OnStart(string[] args)
> > > {
> > > Application.EnableVisualStyles();
> > > Application.SetCompatibleTextRenderingDefault(false);
> > > Application.Run(new Form2());
> > > eventLog1.WriteEntry("Start DONE.");
> > > }
> > > This does not work. When I start my service it just times out.
> > > Any ideas ?
> > >
> > > cheers.
> > > Andrew