Toasts aren't activated after relegation to the action center
The 'pyw' branch supports this based off https://github.com/DatGuy1/Windows-Toasts/issues/35#issuecomment-1462120742, but this should still be done properly with a COM object.
After further investigation this requires registering a COM object. "Translating" the following code snippet from C++/WRL to Python should be implementable in the library, but that's exactly where I'm having issues
class DECLSPEC_UUID(clsid) NotificationActivator WrlSealed
: public RuntimeClass < RuntimeClassFlags<ClassicCom>,
INotificationActivationCallback > WrlFinal
{
public:
virtual HRESULT STDMETHODCALLTYPE Activate(
_In_ LPCWSTR /*appUserModelId*/,
_In_ LPCWSTR /*invokedArgs*/,
/*_In_reads_(dataCount)*/ const NOTIFICATION_USER_INPUT_DATA* /*data*/,
ULONG /*dataCount*/) override
{
std::cout << "activated!";
}
};
CoCreatableClass(NotificationActivator);
Module<OutOfProc>::Create([] {});
Module<OutOfProc>::GetModule().IncrementObjectCount();
Module<OutOfProc>::GetModule().RegisterObjects();
This is most certainly possible with pywin32, probably through register.UseCommandLine or similar, but as mentioned previously I haven't had any luck. A few of my failed attempts can be found at this gist. Any insight would be appreciated.
Using a custom AUMID means the toast can be activated through the action center, but I'm still not sure if using a COM object is the healthy way of implementing it, so leaving this open for now.