Creating a windows service application in visual c++

Ramesh Deekonda 216 Reputation points
2021-02-09T15:32:33.157+00:00

I am trying to create a windows service in visual c+ that will create a worker thread and do some operation. I am using visual studio 2017 community edition.
In visual c++ projects there is the option of creating a windows service exe in the ATL/MFC project type. Alternatively
I have found a sample code provided by microsoft called complete service sample the-complete-service-sample. In the boiler plate created in ATL/MFC service option there is a entry point function called tWinMain. In the complete service sample there is code with its own service entry point and other code. How can I combine these. No project type is specified for the complete service sample.
.Please suggest the way in which I can create a service project and what code is to be added for the service to be up and running.

Developer technologies C++
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RLWA32 49,536 Reputation points
    2021-02-09T17:32:15.93+00:00

    The Microsoft service sample code and the code created for an ATL Service project are not intended to be combined. Each creates an executable for a Windows Service.

    You can also find additional samples for a Windows Service written in C++ (CppWindowsService) at OneCodeTeam


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.