masvmasv
asked on
Application for Start and Stop NT services...
Hi !
I need a C/C++ source code for make a application for start and stop services... example:
MyApp ServiceName Start
MyApp ServiceName Stop
Thanks
I need a C/C++ source code for make a application for start and stop services... example:
MyApp ServiceName Start
MyApp ServiceName Stop
Thanks
Why can't you use NET START and NET STOP?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Anyway, to do it with the WINDOWS API:
1) Use OpenSCManager:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/services_9r1h.asp
2) Call ControlService():
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/services_40x1.asp
1) Use OpenSCManager:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/services_9r1h.asp
2) Call ControlService():
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/services_40x1.asp
Microsoft has TN in MSDN
Creating a Simple Win32 Service in C++
by Nigel Thompson
Hope it helps
Creating a Simple Win32 Service in C++
by Nigel Thompson
Hope it helps
>>Creating a Simple Win32 Service in C++
Unfortunately, this document is no longer available via MSDN...
Unfortunately, this document is no longer available via MSDN...
Hmm... I am running January 2001 library and it is there...
Well, I meant the online version :o)
ASKER
Hi !
This sample works fine for stop services...
But for Start service is not only change the STOP to START... but I found another example...
But this your example was good for help me...
Thanks
This sample works fine for stop services...
But for Start service is not only change the STOP to START... but I found another example...
But this your example was good for help me...
Thanks
Sorry, you are right - you'd have to use 'StartService()' instead of 'ControlService()' in the above sample in order to adapt it to start a service...
ASKER
I cant use "NET START" and
"NET STOP" commands.. ok ?