我正在尝试将某些Windows 10功能集成到我现有的Windows桌面应用程序中。 我在集成Toast通知时遇到了一些困难。
使用Toast通知示例,我能够实现发送和隐藏通知的代码。 当用户点击“活动”通知时,我的应用程序中的事件处理程序也可以正常工作。
但是,当通知被“存档”在“操作中心”中时,用户单击我的通知时不会发生任何事情。 在这种情况下,我该如何应对用户的单击操作?
WinToastHandlerExample* handler = new WinToastHandlerExample;
WinToastTemplate templ = WinToastTemplate(WinToastTemplate::ImageWithTwoLines);
templ.setImagePath(L"C:/example.png");
templ.setTextField(L"title", WinToastTemplate::FirstLine);
templ.setTextField(L"subtitle", WinToastTemplate::SecondLine);
if (!WinToast::instance()->showToast(templ, handler)) {
std::wcout << L"Could not launch your toast notification!";
}
该示例适用于Windows 8;Windows 10技术预览版的操作中心是新的,目前还没有任何SDK可以使用其中的新功能。
toastFailed()
被调用了。你需要在项目中设置其他配置吗? - PhilLab