473,465 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I manually create an icon in the system tray?

The conventional approach is easy enough; drop a NotifyIcon onto a Form.
When the form is loaded - bingo - the icon appears in the System Tray.

I can't use this approach though. I'm writing a service. But I'd like my
service to install an icon on the System Tray so that the user can start /
stop / and otherwise control the service interactively, and without having
to go to the Services applet. How do I do this?

Thanks for your advice.

- Joseph Geretz -
Jul 5 '07 #1
3 2191
On Wed, 04 Jul 2007 22:51:01 -0700, Joseph Geretz <jg*****@nospam.com>
wrote:
The conventional approach is easy enough; drop a NotifyIcon onto a Form.
When the form is loaded - bingo - the icon appears in the System Tray.

I can't use this approach though. I'm writing a service. But I'd like my
service to install an icon on the System Tray so that the user can start
/
stop / and otherwise control the service interactively, and without
having
to go to the Services applet. How do I do this?
Hmmm...I thought that services by definition were not allowed to have UI.
That would preclude the service itself from using the system tray for a
notify icon.

I do note that the "drop a NotifyIcon onto a Form" is just a shortcut for
instantiating a NotifyIcon instance. I suppose you could try doing that
from your service. But because of the above, I wouldn't expect it to work.

If it doesn't work, as predicted, I would expect that the only solution
would be to do what you'd have to do anyway, which is to write an
independent application that communicates with the service, and which
presents the UI to the user. Including (or even limited to) a NotifyIcon,
if that's what you want.

Pete
Jul 5 '07 #2
Adding to what Peter wrote:
<< ...write an independent application that communicates with the
service...>>

If that's what you ultimately must do, then that other application would
interact with your service via the ServiceController class.

For more:
http://msdn2.microsoft.com/en-us/lib...ontroller.aspx

- HTH
Jul 5 '07 #3
Joseph,

Quite simply, you don't do this from your service. This would require
your service to have an interactive user session, which you are not
guaranteed to have.

Rather, you create a program which will be executed when a user logs in
(e.g. put a shortcut to it in the Startup directory) that will place the
icon in the tray (using NotifyIcon).

Your program would then have to use Remoting/WCF (or some other
intra-process mechanism) to communicate with the service.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Joseph Geretz" <jg*****@nospam.comwrote in message
news:OG**************@TK2MSFTNGP02.phx.gbl...
The conventional approach is easy enough; drop a NotifyIcon onto a Form.
When the form is loaded - bingo - the icon appears in the System Tray.

I can't use this approach though. I'm writing a service. But I'd like my
service to install an icon on the System Tray so that the user can start /
stop / and otherwise control the service interactively, and without having
to go to the Services applet. How do I do this?

Thanks for your advice.

- Joseph Geretz -

Jul 5 '07 #4

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

Similar topics

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...
2
by: Brian | last post by:
Dear my friends, I have been helped by many C# gurus here, thank you very much. My small application can help you fetch some good pictures from Internet. You can get it from...
7
by: Danielb | last post by:
I want my application to run most of the time as just an notify icon visible in the system tray, with some dialogs windows that open if the user selects an option from the context menu on the tray...
5
by: Bry | last post by:
Sorry for the repost, but this has been driving me mad for the past few days. There must be a simple solution. There are many other posts about this problem upon an application exit, but my...
6
by: Neo | last post by:
i'd like to create an application which would run in the background, & there'd be an icon in the system tray (can use the notify icon). But HOW can i make the form invisible. What i'd like to do...
0
by: kapcreations | last post by:
I have a system tray app which gets the status of a windows service, and displays the appropriate icon for the status of the service in the systray. the problem I am having is the icon disapears...
6
by: Amongin Ewinyu | last post by:
Hi, I have an application that is controlled by a service. when the service starts, an icon is supposed to be placed in the system tray and this icon is then used to display a balloon...
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...
1
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, how can i remove/disable the tray icon for the started Express Edition from the system tray. Te icon directs me to the express editons website after clicking on it. I dont want these tray...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.