How to change the Tray icon from a Window Service

U

utkarsh

Hi,

I want to develop a Window Service in C# that should be capable of
sisplaying the a icon in the window tray.

Based on some logic in service, icon should be changed to some other
color/image and I needed single click, double click event and context
menu also on that tray icon to perform some other operation and show
some window form.

How can I achieve this in a C# windows service?

I have start creating a window service project in C# with the following
components

1. log4net.dll - for logging purpose
2. NotifyIcon class - to show the icon tray and balloon

After compiling and installing the service. when I run this service it
does not show the icon in tray and do not write the messages in the log
file either.

Even if I try to add the MessageBox.Show(), it throws that error like
it is not set to UserInteratice mode....i am still working on this
part.....

Please let me know if somebody have any idea about why icon in tray is
not coming..... service also not throwing any error as i am cathing the
error and writing in text file....


Thanks,
Utkarsh
 
J

Joshua Belden

I don't think you'll be able to access the system tray from a windows
service, what if the user logs off?

Instead, I think you can write a seperate windows app and use something
like remoting to communicate with the windows service.

Just my 2 cents.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top