Demo hybrid WPF/C++ app using PInvoke for Windows Service Control management.
This application can work under all Windows 7+ (x86/x64) 0S versions with .NET 3.5 Framework installed.
.NET 4.0 have have been chosen for the test application due to fact that .NET 3.5 does not supported mixed debugging (from managed to unmanaged code).
.NET 2.0 Interoperability Recipes: A Problem-Solution Approach By Bruce Bukovics
BadImageFormatException, x86 i x64
Please, refere to this article to learn how to proper build (or even configure without rebuilding) the app for the both x86 and x64 Windows OS versions.
NotifyServiceStatusChangeA function
Using NotifyServiceStatusChange for monitoring services:
microsoft/Windows-classic-samples/Samples/Win7Samples/winbase/monitorservices/monsvc/MonSvc.cxx