Skip to main content

Accessing the systemtray from a service

3 replies [Last post]
patgio
Offline
Joined: 2006-05-17

Is there a way for a service to put an item in the system tray?

I have an application which puts an icon in the system tray and works correctly. Now I want my application to be run at boot time as a service with the system tray icon visible to users when they login.

My platform is windows 2000.

Thanks for your feedback.
Pat

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
patgio
Offline
Joined: 2006-05-17

Thanks for the replies and I see the solution to my problem.

Write the service so that it does not interact with the desktop. Write a helper application, started via the windows start menu, which interacts with the desktop and communicates with the service via a socket or some other interprocess communication method.

My previous approach was to write the service and the user interface in one application installing the service using java service wrapper.

Thanks for your input
pat

jjburke
Offline
Joined: 2004-03-16

Below from Experts-Exchange after query for system service

Service Sample: Create and Install a Service
http://msdn.microsoft.com/library/default.asp?URL=/library/devprods/vs6/...

Creating a Simple Win32 Service in C++
http://msdn.microsoft.com/library/default.asp?URL=/library/techart/msdn_...

A Class For Building An NT Service
system/nt_service.shtml" target="_blank" onclick="return openNew(this.href);">http://codeguru.earthweb.com/system/nt_service.shtml

NT Service App Wizard
system/nt_service_app_wizard.shtml" target="_blank" onclick="return openNew(this.href);">http://codeguru.earthweb.com/system/nt_service_app_wizard.shtml

Custom AppWizard to Create MFC Based Windows NT Services
system/NTService_AppWizard_rehan.shtml" target="_blank" onclick="return openNew(this.href);">http://codeguru.earthweb.com/system/NTService_AppWizard_rehan.shtml

Geeky greek, hope it helps,
Jim Burke

jjburke
Offline
Joined: 2004-03-16

Pat of course you know there are two ways of doing this.

1. Add your TrayIcon to the start menu. My XP has this in c:\Documents and Settings\All Users\Start Menu.

2. Create an official system service using c++ that triggers your TrayIcon. Microsoft support can help with this. Better still, Experts Exchange at www.experts-exchange.com is good. I have written a service but it was a couple of years ago. Basically its a template with start and stop methods that link into the services application.

3. For a demo but it sounds like you have one already. See TrayIcon under https://jdic.dev.java.net/

Good luck,
Jim Burke