- Automatic shutdown
- WinRT-as-COM Server registration based on variadic template instead of marcro
- No WRL (rightfully so)
- Open solution in VS
- Launch Server. It should stay opened
- Launch client while server is running by right-clicking client project -> Debug -> Start new instance
- Observe server shuts down
There has been ask for out-of-proc, non-DLL COM server support with pure cppwinrt for a long time. The above screenshot comes from microsoft/cppwinrt#601. Many people expressed interest, but that thread went nowhere.
Expectedly, cppwinrt wants to maintain its focus on only projection/consumption/authoring. IMO that is a good call. But that doesn't change the fact that this ask is left unfulfiled. And people always have to go back to WRL as it just works™️.
This sample demonstrates how with simple additions, out of proc cppwinrt COM server without WRL is possible.
This sample has two goals:
- Make these classes into WIL (Windows Implementation Library). The API might need some tweak but the concept works.
- Update all
IExploerCommand
andIWidgetProvider
sample to use only cppwinrt + WIL instead of WRL. Let WRL stay in the past.
Subsequently, I hope that powertoys etc would pick up the momentum and migrate to cppwinrt + WIL for its IExplorerCommand
context menu implementation.
- cppwinrt expose a configuration
WINRT_CUSTOM_MODULE_LOCK
that allows users to hook into the module lock mechanism - Write a custom module lock which, (a) notifies when module count reaches 0, and (b) provides customization point for the notification
- cppwinrt also provides
winrt::no_module_lock
so that class factory implementation can be omitted from module object count - Write variadic functions that take in authored type and register class factory recursively