473,769 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13575
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.co m

"Mats-Lennart Hansson" <ap********@hot mail.com> wrote in message
news:%2******** *******@tk2msft ngp13.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.c om> wrote in
message news:ue******** ******@TK2MSFTN GP12.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.co m

"Mats-Lennart Hansson" <ap********@hot mail.com> wrote in message
news:%2******** *******@tk2msft ngp13.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.co m

"Mats-Lennart Hansson" <ap********@hot mail.com> wrote in message
news:ON******** *****@TK2MSFTNG P09.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.c om> wrote in message news:ue******** ******@TK2MSFTN GP12.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.co m

"Mats-Lennart Hansson" <ap********@hot mail.com> wrote in message
news:%2******** *******@tk2msft ngp13.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
10332
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
9923
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 systray icon? please give direction... thx
10
2582
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 above the task bar. Can't figure out why that happens - it looks very ugly... Any ideas ? Zeljko
1
2090
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 administration. Finally, an icon in the system tray would be nice. Can anyone tell me more or less how to do this? Is there some sample from where I can take the basic "structure" of the application?
2
1762
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 the app is designed to start automatically (via a windows service) whoever is logged on. Sometimes, when started by the service, neither the info message nor the tray icon appear. The app is working fine in the background, but without the tray...
4
7993
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 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.
1
2091
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 service. I can send custom commands to start or stop or... any of the worker objects that the windows service will be hosting. What I need to do is to get some information back to the Tray Icon app or the windows form about the actual worker items...
3
7936
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 but the tray icon is not there. If I start the program after Windows has booted up the icon shows every time. I am assuming that the reason is due to the icon being created before the system tray is loaded/running. I have used a timer with...
9
2343
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 have that run separately from my service?
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10208
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10038
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9987
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.