Windows Service.. System Tray

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

Andrew Mueller

Hello all,

I have created a windows service and now I would like to have a
configuration page in the system tray. Basically an icon I can click on
which will just interact with an XML file. What is the best way to do this?

1. How do I use the System Tray and add an icon on it. Yes, probably
basic.. and I can do it with VB but have never tried with C#.

Andrew Mueller
 
Actually, the NotifyIcon class provides this
functionality in .NET

This is one important point here: You should
not interact with the UI when you're a windows
service.

This is:
a.) Because of security (what if the user on
the UI has less privileges then you? You give
them access to a higher-privileged process)

b.) Which UI do you connect to? What if it's a
terminal services server with 10 users
connected in and no one is physically
at the main console (Console0).

You should develop a standalone WinForms app
with a notifyicon and all that goodness that
uses remoting to communicate with the service.

Make sure the service has a way to configure
what Windows users can even connect, and then
once in, what they can configure. That gets
pretty complicated, so I'll leave it up to
you to decide what you're going to do
exactly (not integrate with AD, just have
your own user/pass, or try to use AD
integration, whatever).

-c
 
Andrew, there is a very good example posted on the gotdotnet.com site
under the user samples section. If you haven't been there then you are
missing out bigtime!
 
Back
Top