Windows 10 Toast通知桌面应用程序 [英] Windows 10 Toast Notifications Desktop Application

查看:357
本文介绍了Windows 10 Toast通知桌面应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一些Windows 10功能集成到我现有的Windows桌面应用程序中。我有点卡住集成Toast通知。
使用toast通知示例( https:// code。 msdn.microsoft.com/windowsdesktop/sending-toast-notifications-71e230a2/ )我能够实现代码来发送和隐藏通知。它也工作,当用户点击活动通知时,我的应用程序中的一个事件处理程序被调用。

I'm trying to integrate some Windows 10 features into my existing Windows Desktop application. I am a little stuck integrating the Toast Notifications. Using the toast notification example (https://code.msdn.microsoft.com/windowsdesktop/sending-toast-notifications-71e230a2/) I was able to implement code to send and hide notifications. It also works, that when the user clicks on an 'active' notification an event handler in my application is invoked.

但是,一旦通知被归档在操作中心中,当用户点击我的通知时,不会发生任何操作。如何在这种情况下对点击做出反应?

However, as soon as the notification is 'archived' in the 'Action Center', nothing happens when the user clicks on my notification. How can I react to clicks in such situations?

感谢您的帮助,

Lukas

推荐答案

Windows 10的更新文档描述了如何从Win32应用程序使用Action Center(和互动吐司): http: //blogs.msdn.com/b/tiles_and_toasts/archive/2015/10/15/quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx

There's updated documentation for Windows 10 describing how to use Action Center (and interactive toasts) from a Win32 app: http://blogs.msdn.com/b/tiles_and_toasts/archive/2015/10/15/quickstart-handling-toast-activations-from-win32-apps-in-windows-10.aspx

基本上,你必须使用COM服务器。 ToastNotification本身上的Activated事件是一个运行时事件...如果您的程序已关闭,并且用户从Action Center单击您的Toast,则无用。因此,仅当用户在首次弹出时点击您的烤面包,激活才会激活。当用户从操作中心单击您的烤面包时,它不会触发。这就是COM服务器是什么(或UWP应用程序中的OnActivated方法)。

Basically, you have to use a COM server. The Activated event on the ToastNotification itself is a runtime event... useless if your program has been closed and the user clicks on your toast from Action Center. Thus, Activated only fires if the user clicks your toast when it first pops up. It does NOT fire when the user clicks your toast from Action Center. That's what the COM server is for (or what the OnActivated method in UWP apps is for).

这篇关于Windows 10 Toast通知桌面应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆