C# .NET Windows Service with a form


i wqant to create a windows service that will start up with the pc and the icon sit on the wondows toolbar (like for example the volume control can do)... and then if I detect a errror in its processing I want to make the icon flash ... and then I need to be able to click on the icon and it will bring up a form where I can show details of the error etc.

Could somebody outline the steps in doing this ....

Any help appreciated ...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The best way is to use two different apps - windows service itself, and a winforms app to sit on the toolbar and listen to windows service.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
murfinpAuthor Commented:

how would i listen ..... the service itself needs an event handler that just sits and waits and then processes an event how do i create a console app with an event handler that just sits wand waits for an event to get fired ...

Following up on lazyberezovsky's suggestion, there are several ways you can get the service to communicate with the application that sits on the toolbar.  There are some direct methods, where one application can communicate with another, but I've never looked into that kind of application.  (A quick google search tells me that the magic word for .NET interprocess communication is "remoting," though people also have client/server solutions using "named pipes".)
I would recommend having the service either write windows log messages (a very typical thing for a service to do), or simply write entries in a specific folder.  If you go the log message route, your toolbar application would check for new messages at every n milliseconds, and then change its status (or pop them up).  Similarly, if you write messages to a common folder, your toolbar application would use a FileSystemWatcher to watch for new files (or a modification to a single one, if you prefer).
I would also recommend you make your toolbar application use a NotifyIcon.  These sit (typically) in the rightmost part of the toolbar, like volume and networking and any instant message services you have.  In fact, NotifyIcon makes it trivial to popup a message like the print monitor or your favorite IM service does.  You can do this, and then change your icon to show that there are events waiting for the user to respond.
The biggest issue I perceive would be getting the notify application to start itself.  I don't know how you would get it to pop up automatically for each user.  If the user starts it by themselves, then you're in good shape.
Hope this helps!
Service and it's console can also communicate by WCF.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.