473,396 Members | 1,998 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.

How to add Systray icon when writing windows service using c#

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

Nov 15 '05 #1
6 9894
A service, by default anyway, does not have access to your window station,
so it also doesn't have access to your system tray. You might be able to
work aroudn this with some creative p\invoke, but it wouldn't be highly
recommended.
To do what you want to do you will need to write a seperate application that
displays the system tray icon and communicates whatever is needed with the
service.
"Action" <ac***************@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #2
You can configure the Service in Services - MMC to allow Desktop
interaction. Afterwards you can display forms, trayicons, ...

GP

"Action" <ac***************@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
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

Nov 15 '05 #3
Services MMC?
I can't find any option to allow me to do so...

and...if it can be done....can I enable it in the program rather than
manually?
coz it may not be desirable for use to enable it manually when using the
service...

Thank you
"Günter Prossliner" <g.**********@gmx.at> wrote in message
news:Oj*************@tk2msftngp13.phx.gbl...
You can configure the Service in Services - MMC to allow Desktop
interaction. Afterwards you can display forms, trayicons, ...

GP

"Action" <ac***************@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
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


Nov 15 '05 #4
I saw some service able to create a systray icon
or it user other shortcuts to do so..?

thx

"Daniel O'Connell" <on******@comcast.net> wrote in message
news:hAV7b.414938$Ho3.65699@sccrnsc03...
A service, by default anyway, does not have access to your window station,
so it also doesn't have access to your system tray. You might be able to
work aroudn this with some creative p\invoke, but it wouldn't be highly
recommended.
To do what you want to do you will need to write a seperate application that displays the system tray icon and communicates whatever is needed with the
service.
"Action" <ac***************@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
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


Nov 15 '05 #5
While it CAN be done, it is not advisable. There is a possiblity of
priviledge elevation via windows message attacks (I don't know if .NET helps
with that or not, but is it worth the risk?).
If you must provide the UI from the service, use the most restrictive
possible user account for the service(Definatly not SYSTEM, LocalSystem,
Administrative accounts, etc, I'd say) lest someone trys to compromise it.
Also, I doubt it is as easy as running a simple winforms application
properly across TS. Client\server really makes more sense and is more
secure, plus it is probably easier to run the client code across multiple
accounts and should allow for remote administration as well(this may not be
a prime issue now, but you may need it at some point).

these urls may be of use as well:
http://support.microsoft.com/default...b;en-us;171890
http://support.microsoft.com/default...b;en-us;308403
http://support.microsoft.com/default...b;en-us;821794
http://support.microsoft.com/default...b;en-us;327618

"Action" <ac***************@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP09.phx.gbl...
I saw some service able to create a systray icon
or it user other shortcuts to do so..?

thx

"Daniel O'Connell" <on******@comcast.net> wrote in message
news:hAV7b.414938$Ho3.65699@sccrnsc03...
A service, by default anyway, does not have access to your window station,
so it also doesn't have access to your system tray. You might be able to
work aroudn this with some creative p\invoke, but it wouldn't be highly
recommended.
To do what you want to do you will need to write a seperate application

that
displays the system tray icon and communicates whatever is needed with the service.
"Action" <ac***************@hotmail.com> wrote in message
news:uh**************@TK2MSFTNGP11.phx.gbl...
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



Nov 15 '05 #6
> Services MMC?
I can't find any option to allow me to do so...
Open Start -> Control Panel -> Administrative Tools -> Services
Open the properties of your Service -> "Log On" --> check "Allow Service
Interaction with Desktop"

and...if it can be done....can I enable it in the program rather than
manually?
coz it may not be desirable for use to enable it manually when using the
service...


This setting is stored in the Registry under:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\YOUR_SERVICE_NAME
Create (or modify) a DWORD Registry Entry named "Type", and write the value
0x110 (decimal: 272) into it. Of caurse you must have the required
permission to do that. If you own them, you can do this during the
installation, or via code.

If you don't want to do this, there will be no other possibility to do this
that create another application that displays the trayicon and communicates
with your services.

mfg GP
Nov 15 '05 #7

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

Similar topics

3
by: Jon Bosker | last post by:
I have written an application that lives in the systray but when I try to close windows or logout it does not close my application and therefore prevents windows from shutting down or logging me...
4
by: mario | last post by:
How to put an application in systray with F1 or any shortcut button?
1
by: Christoph Engelhardt | last post by:
Hi newsgroup, What I intend to do: Write a small programm, that will add a new Button to every Window right beside the Buttons for minimizing, maximizing and closing the window in the window's...
3
by: Erik Greene | last post by:
I have written an application that contains a notifyicon that will not dispose or end when Windows shutsdown. I have seen other posts where people are experiencing the same issue (see post in...
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...
9
by: Rotzooi | last post by:
Hi, I have a VB.NET Service application that's running fine under the Local System account. But for configuration purposes I don't want to be dependent on modifying the registry manually or...
8
by: Rob R. Ainscough | last post by:
I have a VS 2005 Windows Service with a Installer project as part of my solution. The Service installs fine but I can't seem to make either of these work: 1. Have the service start after...
2
by: Arvi | last post by:
Hello, Im quite new to c# windows application. i need to write a application which stays on the systray and listens to the SQL Table. (when the value is inserted as 0 - done thru Dataset and...
4
by: Nick Craig-Wood | last post by:
Does anyone have some hints / tips / experience with making a cross platform systray icon? It should work on Windows, Gnome and KDE at minimum. I've seen the win32all code which is very similar...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...

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.