 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bogdan Guest
|
Posted: Sat Feb 18, 2006 12:03 pm Post subject: Using the systray in services |
|
|
How can I process systray messages in a windows service?I need to display
an icon in the systray when the service is running, and remove it when it's
stopped, but the systray requires a handle to window where to send messages
when the icon is clicked or needs to be redrawn, and a service doesn't have
one.
Bogdan. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Sat Feb 18, 2006 9:03 pm Post subject: Re: Using the systray in services |
|
|
"Bogdan" <boprea (AT) xnet (DOT) ro> wrote in message
news:43f70392 (AT) newsgroups (DOT) borland.com...
| Quote: | How can I process systray messages in a windows service?
|
You don't.
| Quote: | I need to display an icon in the systray when the service is
running, and remove it when it's stopped
|
The best approach is to make a separate non-service executable that
continuously monitors the service's status.
Gambit |
|
| Back to top |
|
 |
Vladimir Stefanovic Guest
|
Posted: Sun Feb 19, 2006 1:03 pm Post subject: Re: Using the systray in services |
|
|
Hi,
There is API function ControlService(), which can 'send some
message' to a service from your non-service application.
Besides standard:
SERVICE_CONTROL_STOP
SERVICE_CONTROL_PAUSE
SERVICE_CONTROL_CONTINUE
SERVICE_CONTROL_INTERROGATE
SERVICE_CONTROL_SHUTDOWN
it can be used to send user defined message:
SERVICE_USER_DEFINED_CONTROL
.... and so force the service to do something specific. Mainly, I use
user defined way to tell a service to reload the configuration because
I changed it with my non-service app.
--
Best Regards,
Vladimir Stefanovic |
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Wed Feb 22, 2006 4:03 pm Post subject: Re: Using the systray in services |
|
|
"Bogdan" <boprea (AT) xnet (DOT) ro> wrote in message
news:43f70392 (AT) newsgroups (DOT) borland.com...
| Quote: | How can I process systray messages in a windows service?I need to display
an icon in the systray when the service is running, and remove it when it's
stopped, but the systray requires a handle to window where to send messages
when the icon is clicked or needs to be redrawn, and a service doesn't have
one.
|
Services are not meant to have any UI whatsoever. Some command line switches,
perhaps, but, as Remy quite rightly put it, you need a non-service bit to run
in the GUI to catch messages in the GUI's message queue. Using Vladimir's
post, you can forward the relevant ones onto your service somehow.
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk |
|
| Back to top |
|
 |
Boba Guest
|
Posted: Thu Feb 23, 2006 3:03 pm Post subject: Re: Using the systray in services |
|
|
"Bogdan" <boprea (AT) xnet (DOT) ro> wrote in message
news:43f70392 (AT) newsgroups (DOT) borland.com...
| Quote: | How can I process systray messages in a windows service?I need to
display
an icon in the systray when the service is running, and remove it when
it's
stopped, but the systray requires a handle to window where to send
messages
when the icon is clicked or needs to be redrawn, and a service doesn't
have
one.
Bogdan.
Most of my services create a hidden window for that. |
Many of them provide User Interface for faster communication
(instead of loading administrative tools). The systray icon
sends messages within the 0x0200-0x2009 range. I also provide
an option of dispaying this icon through the service cpl
config tool. Boba |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|