BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using the systray in services

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Bogdan
Guest





PostPosted: Sat Feb 18, 2006 12:03 pm    Post subject: Using the systray in services Reply with 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.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Sat Feb 18, 2006 9:03 pm    Post subject: Re: Using the systray in services Reply with quote



"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





PostPosted: Sun Feb 19, 2006 1:03 pm    Post subject: Re: Using the systray in services Reply with quote



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





PostPosted: Wed Feb 22, 2006 4:03 pm    Post subject: Re: Using the systray in services Reply with quote

"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





PostPosted: Thu Feb 23, 2006 3:03 pm    Post subject: Re: Using the systray in services Reply with quote

"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.