windows service opens form in windows application

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

Hi,
How do I get my Windows service opens form in windows application ?

I have tis bit of code in :
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.
cheers.
Andrew
 
You can Show a form from a windows service by checking the "Allow service to
interact with desktop" for your service from Windows Service Manager
Properties window.

Note that this won't work in Vista; in short... don't do it! Have a
separate UI app (pehaps run at user startup) that talks to the service
via IPC, and leave the service to run silent.

Marc
 
Back
Top