Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Please see the article on docs.microsoft.com for the latest documentation.
Anonymous
November 02, 2015
As per this article, After Adding the COM server to my Win32 app, the toast is being persisted in Action center. But on tapping the toast either my App's or COM server's (NotificationActivator) Activate method is not being triggered.
I am using DOM XML API to display the toast as per the Win32 C++ sample:
code.msdn.microsoft.com/.../sending-toast-notifications-71e230a2
I am not using any WinRT API in my Win32 app to display the toast notification.
To register COm object when my App starts, I tried to call RegisterObjects() method as described in this article.
But there is no RegisterObjects() method provided by MicroSoft::WRL::Module class.
Instead I have used Module<InProc>::GetModule().RegisterCOMObject(...) method to register the COM object.
Please suggest if something i have missed.
Anonymous
November 03, 2015
After adding the COM server to my Win32 app, the toast is persisted in Action center.
But My Win32 application is being launched for every few minutes even though there is no user interaction with the toast in Action center. Is it expected behaviour?
Anonymous
November 09, 2015
Any update on my previous queries? Please let me know if you need any details from me.
Anonymous
November 10, 2015
@Kiran - I've told Lei to follow up, he'll look into this when he has a chance.
Anonymous
November 19, 2015
@Lei: Could you Please confirm whether it is usage problem or a bug in APIs?
Anonymous
November 20, 2015
Kiran, can you provide the actual code of your COM server, and actual code snippets of how you're registering the COM server? Lei's working on asking whether anyone knows of issues like you mentioned (we are only experts at the normal WinRT API's but we'll attempt to help). It would help us solve your problem if we could see your actual code. You can post code on GitHub GIST and link it here.
Anonymous
November 30, 2015
Is there actual code available in GitHub? I modified DesktopToastsSample project, but could not make it works.
Anonymous
December 01, 2015
@andrewbares7:
As I am unable to upload the complete zip file of my COM Server sample, I have posted few files of COM server and Desktop toast app implementation.
The GitHub GIST link for the same is: gist.github.com/.../512f658da1847044a7b6
Please suggest if anything missed.
Anonymous
December 07, 2015
@andrewbares7: Any update on my last post?
Anonymous
December 09, 2015
This issue has become a blocker for my project work.
Today I have observed following behaviour with WRL COM based toast notifications from Desktop Application:
Anonymous
December 17, 2015
Hello, what is the type of variables DocumentIO and factory?
Anonymous
December 20, 2015
Thanks for your sample code! By doing some tests, DesktopToastsSample.exe could be launched after clicking the toast notification, but the exported interface Activate seems not called. Do you have the same issue? Is there anything I missed?
Anonymous
December 21, 2015
Yes. I am having the same issue that you observed.
Anonymous
December 22, 2015
The comment has been removed
Anonymous
December 22, 2015
Hi, Kiran
I fixed the issue and make DesktopToastsSample.exe works. The issue was caused by without calling Module<OutOfProc>::GetModule().UnregisterObjects();.
I post my source code in gist.github.com/.../8701312744f94bcd8701
Anonymous
December 22, 2015
Hi, Kiran
Sorry, I forgot to mention that if you using Windows 10 SDK, the idl for interface INotificationActivationCallback is not necessary. The interface is available in %Win10SDK_Path%IncludeumNotificationActivationCallback.h.
Anonymous
December 22, 2015
@Calvin Lin: Thanks for sharing sample code.
From your sample,
hr = xmlDocument->LoadXml(toastXML.Get()); is always returning "XML_E_BADSTARTNAMECHAR" (0xC00CE504) error code for me. What could be the problem?
Anonymous
December 23, 2015
@Kiran
Do you compile the sample program with Win 10 SDK? The format of the toast in my DesktopToastsSample is for adaptive toast which is new of Windows 10. I compiled the sample program with Win 10 SDK. Maybe it could be the root cause. Or You could try the original sample code to launch toast.
Anonymous
December 27, 2015
@Calvin Lin, I tried with the original sample code to launch the toast. And I made the changes to the sample code as per your sample except the CreateToastXML method.
Still on tapping the toast, CToastActivator::Activate is not called for me.
Anonymous
December 28, 2015
@Kiran, By testing my sample, I found the COM server was not stable. Sometimes, the COM server got crashed when action center tried to call CToastActivator::Activate. I still try to find out the root cause. You could check application event log and system event log. Here are the steps how I verified the problem:
Anonymous
December 28, 2015
The comment has been removed
Anonymous
December 29, 2015
@Calvin Lin, The CToastActivate::Activate() is called when I tap on the Toast notification. But it is not called when I click on the foreground action button (Adaptive toast) on the Toast notification. Is there any other Activate override function to handle the actions?
And When i try to Activate the instance of ToastNotificationHistory as:
ComPtr<ABI::Windows::UI::Notifications::IToastNotificationHistory> history;
HRESULT hr = Windows::Foundation::ActivateInstance(StringReferenceWrapper(RunTimeClass_Windows_UI_notifications_ToastNotificationHistory).Get(), &history);
It is returning HRESULT error as "REGDB_E_CLASSNOTREG". How can i use ToastNotificationHistory in desktop app?
Anonymous
February 03, 2016
I have really hard time understanding why this toast system had to be made so complex.
I mean look at the simplicity of:
int WINAPI MessageBox(
In_opt HWND hWnd,
In_opt LPCTSTR lpText,
In_opt LPCTSTR lpCaption,
In UINT uType
);
compared to this toast monstrosity. Over-engineered APIs like this are the reason for software bloat.
Also what's with the application shortcut? Why should a UI message have anything to do with a shortcut file?
Why couldn't there be just a registry entry somewhere where to append your application identifier and CLSID?
Could you even please bother to provide some rich code examples how to initialize and run the COM server within a dynamic link library or an executable? These small code snippets are hard to understand.
Anonymous
February 17, 2016
Could you please upload the entire code for this? Thanks.
Anonymous
February 19, 2016
Is the SupressPopup functionality available in C++?
Also, could you please give working example of put_ExpirationTime? I can't figure out the parameter type for this function.
Anonymous
February 19, 2016
Can someone post a complete, working code sample somewhere. Thanks
Anonymous
February 23, 2016
So if I understood correctly, nobody can make it work in c++?
We're stuck with .NET/cs?
Anonymous
February 24, 2016
Can someone please post an entire Visual Studio solution? Even if it doesn't work, it'd be better than this.
I can't get these bits and pieces from here, github, and pastebin to compile.
Thanks
Anonymous
February 24, 2016
Martin, you have a .NET/C# solution that works? Please post it. Preferably a complete, ready to compile, sample.
Anonymous
February 25, 2016
No I don't. I thought there was, but apparently there isn't ...
There's only universal app working examples. But that's very restrictive...
Anonymous
February 26, 2016
BTW, commenting
"if (nRefCount == 0) delete this;"
is stupid. Who removes deletes?
Maybe changing
m_nRefCount = 0;
to
m_nRefCount = 1;
would be better?
Anonymous
March 07, 2016
I'm getting an assertion failure on this:
Module<OutOfProc>::GetModule().RegisterObjects();
more precisely:
Module<OutOfProc>::GetModule()
I'm working with Calvin Lin's code sample.
Any Ideas?
Anonymous
March 08, 2016
Hello , who do that on c# , and thank you
Anonymous
March 14, 2016
The Activated event is missing UserInput, while INotificationActivationCallback::Activate method does have the user input data, but only works with string args defined in the notification's XML. In real life, notifications are fired by various modules which attach complex objects to the notification, that they expect the be used once the user clicks the toast. This is impossible to do with just string args. It would have been possible with UserInput in the Activated event, but it's missing. The INotificationActivationCallback::Activate method, with all its ActionCenter and dead application features is useless for the everyday purpose when we just need to implement functionality on a live toast.
Also, why is there an IToastNotificationActionTriggerDetail interface in 10.0.10586.0 sdk and no documentation available online for Win32 apps? Why doesn't the IInspectable argument of Activated implement this interface?
Anonymous
April 04, 2016
Hi guys, sincerely apologize for missing a full sample and ignoring some of the comments previously - the feature was shipped by a different team and due to preparation for some work in the upcoming Windows update and Build 2016, publishing the sample was delayed. The sample that works e2e is now published on GitHub here:https://github.com/WindowsNotifications/desktop-toasts Please follow up with questions and thanks again.
Anonymous
April 15, 2016
When the number of notifications in Action Center exceeds 20, I get an extra notification saying “More notifications”. If I click on it, my app opens and all the other 20 toasts from Action Center disappear. I wasn’t able to find any documentation on this. Can you please tell me if this is expected behavior?
Anonymous
September 07, 2016
In a messaging app each time a new message comes in chat I show toast notification and hold pointers to all IToastNotifications shown.When the user clicks the notification the chat is opened. He also can open it by himself. Also this chat can be marked as read from a different device.If any of those three events occur all the notifications from that chat are removed using IToastNotifier::Hide method. So I have some questions:1. If the app gets relaunched there is no way to enumerate the notifications for hiding all of them related to a specific chat - user should have to deal with all the notifications that were left in the action center manually? Will they at least hide from the action center using IToastNotifier::Hide before the app was closed, but after the notification went from screen to the action center? 2. Starting with Windows 10 anniversary update I get reports and logs, that IToastNotifier::Hide sometimes takes up to two minutes (!) before returning. Also I got one debug dump where a call to IToastNotifier::Hide resulted in an inside call to Activated event handler of some (other or the one that I was hiding, I'm not sure) IToastNotification.Is this a valid and correct way to work with the notifications? Why IToastNotifier::Hide takes sometimes so huge amount of time (the app freezes) and sometimes calls the Activated and maybe other handlers inside itself? What is the right way to deal with it? Is there a way to hide the notifications from my app that went to the action center already?
Anonymous
November 23, 2016
I see that up on GitHub, there is a fully working version of this in C# but the C++ DesktopToastsSample still uses the old Template model. Is there a FULL working version in C++ anywhere? Also, I would prefer not to have to hook into ActionCenter. All I really want to do is to use the new GenericTemplate TemplateType to create a more specific type of toast. The only action I need users to do is to click on the toast to acknowledge it.
Anonymous
December 30, 2016
Who's giving these posts 5 star ratings? This doesn't even work.
Anonymous
January 20, 2017
Hi, I'd like to know if there's a way for my app to be notified when the user sets the Notifications (either Global or per app) to Off from Windows Settings . Thanks!
Anonymous
July 17, 2017
The activation doesn't work if the app is running as administrator.
Anonymous
September 01, 2017
I have exactly same problem as AYCohen. Everything works perfectly fine from user and from Administrator Toasts are not activated.Does anyone have a solution for this problem ?
Anonymous
November 22, 2017
Hi,I´m currently developing an extensions (DLL) for a third party desktop application. Therefore i do not have a standalone application (.EXE).How can i make my ToastNotifications be persistent without having to register the COM server in a seperate non-UI process.Thanks!
Anonymous
November 28, 2017
Hi leixu2046,I want to implement desktop-toasts with progressbar.I have seen many sample codes of deskop app on GITHUB and offical web, but I cannot find the ignore code with "..." in In "Sending and handling interactive toast notifications" section.For C++ language, how to initializa "IXmlDoxcumentIO" variables? Other words,how I load xml file to IXmlDocument? ThanksThis is my code : /************ start ******/HStringReference toastXML( L"" L"" L"" L"Downloading this week's new music..." L"" L"" L"" L""); ComPtr DocumentIO ;//throw exception,becacust I don't know how to initializa "IXmlDoxcumentIO" variableshr = DocumentIO->LoadXml(toastXML.Get());ComPtr xml;// is this load xml file to IXmlDocument?DocumentIO.CopyTo(toastXml.GetAddressOf());... ComPtr toast;hr = factory->CreateToastNotification(xml, &toast); ... hr = notifier->Show(toast.Get());/ end ******************/
Please sign in to use this experience.
Sign in