You can write your own wWinMain by defining DISABLE_XAML_GENERATED_MAIN
.
int __stdcall wWinMain(HINSTANCE, HINSTANCE, PWSTR, int)
{
{
void (WINAPI *pfnXamlCheckProcessRequirements)();
auto module = ::LoadLibrary(L"Microsoft.ui.xaml.dll");
if (module)
{
pfnXamlCheckProcessRequirements = reinterpret_cast<decltype(pfnXamlCheckProcessRequirements)>(GetProcAddress(module, "XamlCheckProcessRequirements"));
if (pfnXamlCheckProcessRequirements)
{
(*pfnXamlCheckProcessRequirements)();
}
::FreeLibrary(module);
}
}
//instead of winrt::init_apartment(winrt::apartment_type::single_threaded);
winrt::init_apartment(winrt::apartment_type::multi_threaded);
::winrt::Microsoft::UI::Xaml::Application::Start(
[](auto&&)
{
::winrt::make<::winrt::Packaged::implementation::App>();
});
return 0;
}