how to install/register a windows service programatically?  
Author Message
bijubiju





PostPosted: Visual C++ Language, how to install/register a windows service programatically? Top

hi, I have created a windows service using ATL wizard in visual c++ 6.0. How do i register, start and stop the service programatically
Is there any other way to create a service( not to be an exe)


Visual C++10  
 
 
Sarath.





PostPosted: Visual C++ Language, how to install/register a windows service programatically? Top

See Creating a Simple Win32 Service in C++

You have to add an entry in registry in order to register your service. and StartServiceCtrlDispatcher can be used to Spawn the service. Please see the example



 
 
bijubiju





PostPosted: Visual C++ Language, how to install/register a windows service programatically? Top

Thanks for the response

I have a working version service that i created. It is an exe. now i want to register and start the service programatically.

I can register and run from command line( as it is an exe)

i register it by the following command

myservice -/RegServer

and start the service by

net start myservice.

but i want to register and start through another program. i will my post registration and starting code.

by this code i am able to register but not able to start

i m getting the following error :

could not start service on Local computer

Error 1053: The service did not respond to the start control request in a timely fashion

After this i am unable to delete the service also...

Any solution



 
 
Damien Watkins - MSFT





PostPosted: Visual C++ Language, how to install/register a windows service programatically? Top

Hello

Re: how to install/register a windows service programatically

Such questions (on VC++ 6.0 programming) are outside the scope of this forum - for the scope of the VC Language forum please look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=789657&SiteID=1

For such issues please use an appropriate newsgroup, potentially one at http://msdn.microsoft.com/newsgroups.

OTP

Thanks

Damien