I have found an example how make a Toast Notifications in Windows 10 on c++
https://github.com/WindowsNotifications/desktop-toasts/blob/master/CPP/DesktopToastsSample.cpp
In my opinion this code has C style rather than C++ which doesn't look very good to me.
I've found a wrapper over winrt for с++ https://github.com/Microsoft/cppwinrt
Now I am trying to write similar code like in the example but with winrt.
In example There are lines
ComPtr<IToastNotificationManagerStatics> toastStatics;
HRESULT hr = Windows::Foundation::GetActivationFactory(
HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(),
&toastStatics);
I started writing code
#include "winrt/Windows.UI.Notifications.h"
#include "winrt/Windows.Foundation.h"
using namespace winrt::Windows::UI::Notifications;
using namespace winrt::Windows::Foundation;
void main() {
auto igetaf = IGetActivationFactory();
igetaf.GetActivationFactory(???);
- How to convert string to winrt::hstring
- How to convert RuntimeClass_Windows_UI_Notifications_ToastNotificationManager hstring
The documentation doesn't even say what strings I can use
docs.microsoft.com/en-us/uwp/api/windows.foundation.igetactivationfactory (Not enough reputation :()
Can you give me an example of working code. ?