Win32 API Experimental(or Extension) features
Win32 API Experimental(or Extension) features.
It is a library that helps to more easily implement tasks such as service program creation and process creation for each user account in Windows environment.
It is implemented with outdated syntax and features because it is also designed for use in legacy development environments (Visual Studio 2008 SP1).
With MSYS2
cd test
mkdir build && cd build
if [ "$MSYSTEM" = "MSYS" ]; then
cmake ..
else
cmake -G "MinGW Makefiles" ..
fi
cmake --build .
if [ "$?" -eq 0 ]; then
export LC_ALL=C; unset LANGUAGE
ctest . --verbose
fi
With Visual Studio
cd test
mkdir build
cd build
cmake ..
cmake --build . -- /p:CharacterSet=Unicode
if errorlevel 0 ctest . --verbose -C Debug
We usually recommend using CMake. However, if you are using Visual Studio directly, add {This repository}/include to the 'Additional Include Directories property'.
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# create project
project(MyProject)
# add executable
add_executable(tests tests.cpp)
# add dependencies
include(cmake/CPM.cmake)
CPMAddPackage("gh:ntoskrnl7/[email protected]")
# link dependencies
target_link_libraries(tests win32ex)
#include <iostream>
#include <Win32Ex/System/Process.hpp>
#include <Win32Ex/System/Service.hpp>
// or #include <Win32Ex.h>
// or #include <Win32Ex/System.h>
Win32Ex::System::Service SimpleService("SimpleSvc");
int main()
{
std::cout << Win32Ex::System::Process::All().size();
Win32Ex::System::Service::Instance<SimpleService>::Get()
.OnStart([]() {
// TODO
})
.OnStop([]() {
// TODO
})
.OnPause([]() {
// TODO
})
.OnContinue([]() {
// TODO
})
.OnError([](DWORD ErrorCode, PCSTR Message) {
// TODO
})
.Run();
return 0;
}