473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Tray icon in Windows service

Hi,
I'm having a hard time getting my service to show a sys tray icon. I've
tried to create a separate Windows application where I simply add a
notification icon to the form. In the OnStart method of the service I simply
try to start the windows application which then should show the icon.

I can't get it to work! When I run the separate Windows application the icon
turns up, but when I start it from the service it doesn't. How should I do
this?

Thanks,
Mats-Lennart
Nov 16 '05 #1
3 13527
Mats,

You should not have your service try and show a tray icon. Services, in
general, should not have a user interface. However, that doesn't mean that
you can't have a user interface that communicates with the service. The
reason for this is that you can not always be guaranteed that you will have
an active desktop session to interact with.

What you should do is provide a remoted object that can be connected to,
or use some other kind of communication between the client (which would have
the tray notification icon), and the service.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,
I'm having a hard time getting my service to show a sys tray icon. I've
tried to create a separate Windows application where I simply add a
notification icon to the form. In the OnStart method of the service I simply try to start the windows application which then should show the icon.

I can't get it to work! When I run the separate Windows application the icon turns up, but when I start it from the service it doesn't. How should I do
this?

Thanks,
Mats-Lennart

Nov 16 '05 #2
Hi,
Thanks for answering. I understand your point but my problem remains. How do
my service communicate with the user interface program (the client)?

Regards,
Mats-Lennart
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ue**************@TK2MSFTNGP12.phx.gbl...
Mats,

You should not have your service try and show a tray icon. Services, in general, should not have a user interface. However, that doesn't mean that you can't have a user interface that communicates with the service. The
reason for this is that you can not always be guaranteed that you will have an active desktop session to interact with.

What you should do is provide a remoted object that can be connected to, or use some other kind of communication between the client (which would have the tray notification icon), and the service.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,
I'm having a hard time getting my service to show a sys tray icon. I've
tried to create a separate Windows application where I simply add a
notification icon to the form. In the OnStart method of the service I

simply
try to start the windows application which then should show the icon.

I can't get it to work! When I run the separate Windows application the

icon
turns up, but when I start it from the service it doesn't. How should I do this?

Thanks,
Mats-Lennart


Nov 16 '05 #3
Mats,

There are a number of ways to do this. The easiest way would be to
expose an object through remoting which you could connect to through your
client application.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:ON*************@TK2MSFTNGP09.phx.gbl...
Hi,
Thanks for answering. I understand your point but my problem remains. How do my service communicate with the user interface program (the client)?

Regards,
Mats-Lennart
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ue**************@TK2MSFTNGP12.phx.gbl...
Mats,

You should not have your service try and show a tray icon. Services,
in
general, should not have a user interface. However, that doesn't mean that
you can't have a user interface that communicates with the service. The
reason for this is that you can not always be guaranteed that you will

have
an active desktop session to interact with.

What you should do is provide a remoted object that can be connected

to,
or use some other kind of communication between the client (which would

have
the tray notification icon), and the service.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mats-Lennart Hansson" <ap********@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi,
I'm having a hard time getting my service to show a sys tray icon. I've tried to create a separate Windows application where I simply add a
notification icon to the form. In the OnStart method of the service I

simply
try to start the windows application which then should show the icon.

I can't get it to work! When I run the separate Windows application
the icon
turns up, but when I start it from the service it doesn't. How should

I do this?

Thanks,
Mats-Lennart



Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Lalit | last post by:
Hi Friends, I have developed a Windows service. Now i need icon for this service in systray and context menu fo this icon. Can i do this? With regards, Lalit
6
by: Action | last post by:
I can add a systray icon in normal windows application... but when i do it in windows service, the systray icon just don't show up is that because i don't have any "component" to contain the...
10
by: Zeljko | last post by:
Hi, I have a form with a tray icon. However, when I minimize the form, it stays visible - not in the task bar (I have showintaskbar property set to false), but in a form of a rectangle sitting...
1
by: manuel.ricca | last post by:
Hello, I'm just starting to code a windows service in C#. My service needs to create multiple threads, each one responding to TAPI events. Then I will need to have a client connect to it for...
2
by: quilkin | last post by:
Hi I have an control app which starts up with a small info message then sits down as a tray icon while it does its work. When started manually (e.g.from a shortcut) this always works fine. However...
4
by: utkarsh | last post by:
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...
1
by: =?Utf-8?B?VzFsZDBuZTc0?= | last post by:
I need to create a Windows Service, which will be hosting a couple of worker classes, each in there own thread. I will be creating a tray Icon (Notify Icon) and a windows form to manage this...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
9
by: dm3281 | last post by:
Hello -- I plan on writing a C# service using VS2005. If I want my service to have a tray icon, is this typically done from within my service or do/should I create a controller application and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.