diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-08-18 18:46:06 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-08-18 18:46:06 +0000 |
commit | c5a9bf1c331dab3e9a31abb1f9e5687fb280bf64 (patch) | |
tree | 550a479ca631694e20c5b7bdf539d7ae4f1e100f /plugins/Toaster/src/toast_notification.cpp | |
parent | f54a8b0bfb54acef4454ccdb5ea8aff9d0cf3ef6 (diff) |
Toaster: added MS_POPUP_QUERY service
git-svn-id: http://svn.miranda-ng.org/main/trunk@14990 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Toaster/src/toast_notification.cpp')
-rw-r--r-- | plugins/Toaster/src/toast_notification.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index 856129f648..3430b404e0 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -3,10 +3,7 @@ ToastNotification::ToastNotification(_In_ wchar_t* text, _In_ wchar_t* caption, _In_ wchar_t* imagePath) throw()
: _text(text), _caption(caption), _imagePath(imagePath)
{
- HRESULT hr = Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &_notificationManager);
-
- if (FAILED(hr))
- RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+
}
ToastNotification::~ToastNotification()
@@ -157,10 +154,15 @@ HRESULT ToastNotification::Setup(_In_ ABI::Windows::Data::Xml::Dom::IXmlDocument HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXmlDocument** xml)
{
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotificationManagerStatics> notificationManager;
+ HRESULT hr = Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), ¬ificationManager);
+ if (FAILED(hr))
+ RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+
ABI::Windows::UI::Notifications::ToastTemplateType templateId = _imagePath == nullptr
? ABI::Windows::UI::Notifications::ToastTemplateType_ToastText02
: ABI::Windows::UI::Notifications::ToastTemplateType_ToastImageAndText02;
- HRESULT hr = _notificationManager->GetTemplateContent(templateId, xml);
+ hr = notificationManager->GetTemplateContent(templateId, xml);
if (FAILED(hr))
return hr;
@@ -208,8 +210,13 @@ HRESULT ToastNotification::Show() HRESULT ToastNotification::Show(_In_ ToastEventHandler* handler)
{
+ Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotificationManagerStatics> notificationManager;
+ HRESULT hr = Windows::Foundation::GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), ¬ificationManager);
+ if (FAILED(hr))
+ RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+
Microsoft::WRL::ComPtr<ABI::Windows::UI::Notifications::IToastNotifier> notifier;
- HRESULT hr = _notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), ¬ifier);
+ hr = notificationManager->CreateToastNotifierWithId(StringReferenceWrapper(::AppUserModelID).Get(), ¬ifier);
if (FAILED(hr))
return hr;
|