Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Service control Messages 1

Status
Not open for further replies.

jhopper

Programmer
Mar 15, 2004
6
AU
I have a service written in c++, running quite nicely. I also have a VB application that can start and stop the service, by sending the start and stop messages. However I would also like the VB app to report on the current status, and update settings on the run.

I like to think I could use messages like the start and stop messages, however, I can't see how to get data in or out that way. Is there a way? The point of this is to remotly manager a service.
 
You have several options. Just look in the MSDN under "Inter-Process Communication"

[sub]I REALLY hope that helps.[/sub]
Will
 
I was more hoping that there would be a comunications method that was part of the service framework. Can someone confirm that this does not exist?
 
What about calling ControlService with SERVICE_CONTROL_INTERROGATE?
 
Oh, sorry, you are doing it from a VB application, and besides, you sound like you wanted application specific information.[blush]

I don't know of any method for communicating with a service through the service API. You might have to consider some other interprocess communication.
 
You can specify the computer name in the call to OpenSCManager. Once this has succeeded, you can do everything with it as you're used to. Of course you need to have appropriate access rights.

For a local computer :

SC_HANDLE hSC = OpenSCManager ( NULL, ...
or
SC_HANDLE hSC = OpenSCManager ( "", ...

For a remote computer with the name "ComputerName" :

SC_HANDLE hSC = OpenSCManager ( "\\\\ComputerName", ...

(Note: C++ requires to write every backslash twice (\\\\ComputerName instead of \\ComputerName), VB may or may not, I don't know.


Marcel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top