title: Toast Notifications Windows 10 with cppwinrt library
body: <p>I  have found an example how make a Toast Notifications in Windows 10 on c++</p>
  
  <p><a href="https://github.com/WindowsNotifications/desktop-toasts/blob/master/CPP/DesktopToastsSample.cpp" rel="nofollow noreferrer">https://github.com/WindowsNotifications/desktop-toasts/blob/master/CPP/DesktopToastsSample.cpp</a></p>
  
  <p>In my opinion this code has C style rather than C++ which doesn't look very good to me.</p>
  
  <p>I've found a wrapper over winrt for с++ <a href="https://github.com/Microsoft/cppwinrt" rel="nofollow noreferrer">https://github.com/Microsoft/cppwinrt</a></p>
  
  <p>Now I am trying to write similar code like in the example but with winrt.</p>
  
  <p>In example There are lines</p>
  
  <pre><code>ComPtr&lt;IToastNotificationManagerStatics&gt; toastStatics;
  HRESULT hr = Windows::Foundation::GetActivationFactory(
     HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(),
  &amp;toastStatics);
  </code></pre>
  
  <p>I started writing code</p>
  
  <pre><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(???);
  </code></pre>
  
  <ol>
  <li>How to convert string to winrt::hstring</li>
  <li>How to convert RuntimeClass_Windows_UI_Notifications_ToastNotificationManager hstring</li>
  </ol>
  
  <p>The documentation doesn't even say what strings I can use</p>
  
  <p>docs.microsoft.com/en-us/uwp/api/windows.foundation.igetactivationfactory (Not enough reputation :()</p>
  
  <p>Can you give me an example of working code. ?</p>