Andy Schmidt
Andy Schmidt

Reputation: 88

Is it possible to create Windows Service Applications with C++/WinRT?

I am designing a new Windows Service Application and I would like to know if modern C++/WinRT can be used to build a binary executable conforming to the interface rules of the Service Control Manager (SCM).

Upvotes: 2

Views: 933

Answers (2)

Kenny Kerr
Kenny Kerr

Reputation: 3115

C++/WinRT is routinely used within Windows services to access various Windows APIs so in that sense yes it certainly works. It does not however provide any support for actually implementing the Windows service API callbacks, but those are not hard to implement yourself. Here's an example.

Upvotes: 3

Michael Chourdakis
Michael Chourdakis

Reputation: 11158

From the documentation of ServiceMain:

Minimum supported client Windows XP [desktop apps only]

Minimum supported server Windows Server 2003 [desktop apps only]

If using Xaml Islands to include C++/WinRT inside a desktop application then it will work, but what is the point of all that anyway? Service applications cannot have a GUI, which eliminates the need of UWP or C++/WinRT.

WinRT is based on C++ 17 and you can very well use all C++ 17 features in the service application.

Upvotes: 0

Related Questions