Click here to Skip to main content
15,077,641 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to create c++ windows service

What I have tried:

I want to write a service in C++ .
Service is needed in C++ in order to not use .net.\
The service needs to run a batch file after a specified time interval.
Tell me some good link on how to do such?
I wrote c++ code that can see in the screenshot.
install exe as service by command
Sc create MyService binPath=C:\s.exe DisplayName=″My New Service″ type=own start=auto
When I tried to start the service I got an error.
error 1053 service did not respond in timely fashion
Updated 10-Apr-21 1:08am
[no name] 9-Oct-16 11:00am
google will find you many examples of how to create a service.
Suvendu Shekhar Giri 9-Oct-16 11:29am
Try debugging the code through a test app.
Member 15143491 10-Apr-21 7:10am
Found the solution means please help me

1 solution

Your code - as it shown in the screenshot (and next time it will be better to copy paste it as part of the question) - has nothing to do with services...
Windows services have definite rules and must be written according them...
In your case you have no service entry point, so your code can not be installed as service...

You have several options to start with:[^]
A Simple C++ Class Framework for Services[^]

You also can use the ATL template wizard in Visual Studio to create a skeleton of a service...
Member 15143491 10-Apr-21 7:08am
found a complete solution to create a windows service application in C++ please guide me, please I'm new to this field and I'm a student.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900