Toast++ v1.17 A set of C++ classes to
provide an encapsulation for Toast Notifications for Desktop Win32 applications
These are the popups you see from Windows normally in the bottom right of the
screen which accumulate into Action Center. These toast notification APIs are exposed
as Windows Runtime interfaces but can be used from standard Desktop Win32 applications
with some work. The Toast++ classes ease this integration process.
The classes provided are as follows:
CManager provides a class based encapsulation of an IToastNotifier
Windows Runtime interface as well as helper functionality for integrating Win32
applications with Toast Notifications.
CToast provides a class based encapsulation of an IToastNotification
Windows Runtime interface as well as support for callback notification through this
interface. It also provides a method to setup the toast UI via an XML string parameter.
CContent provides a class which allows you to create the XML
for toasts using C++ classes and member variables. For more information on the detailed
Toast schema, please see
https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
CActions, CActionsSnoozeAndDismiss,
CAdaptiveGroup, CAdaptiveImage, CAdaptiveSubgroup,
CAdaptiveText, CAppLogo, CAttributionText,
CAudio, CButton, CButtonDismiss,
CButtonSnooze, CContextMenuItem, CGenericBinding,
CGenericImage, CGenericText, CHeroImage,
CProgressBar, CSelectionBox, CSelectionBoxItem,
CTextBox, CVisual & CWin81Binding
are all the sub classes used by CContent.
An example of the demo app running along with a couple of popped toasts is shown
below:
The enclosed zip file contains the Toast++
source code and a VC 2017 MFC dialog based application which demonstrates most of
the classes functionality.
Features
- Provides one C++ Header only module to encapsulate the Windows Toast Notifications
most useful to desktop developers. Specifically ToastPP::CToast encapsulates
a
Windows::UI::Notifications::ToastNotification WinRT class and ToastPP:CManager
encapsulates a
Windows::UI::Notifications::ToastNotifier class.
- The demo app also includes a fully worked example of using
INotificationActivationCallback to implement a COM server which gets notifications
from Action Center in your Desktop Win32 application.
- Included in the download is a VC 2017 MFC dialog based application which
exercises the Toast++ classes functionality as well as allowing you to try out
different style toasts. The toast samples provided in the demo app are based
on the samples included in the
Notifications Visualizer for Windows 10 store application.
Copyright
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
Updates
v1.17 (28 May 2023)
- Updated copyright details.
- Updated module to indicate that it needs to be compiled using
/std:c++17. Thanks to Martin Richter for reporting this issue.
v1.16 (2 May 2022)
- Updated copyright details.
- Updated the code to use C++ uniform initialization for all variable
declarations.
v1.15 (11 December 2021)
- Updated copyright details.
- Updated some SAL annotations and constness for various methods.
v1.14 (4 April 2020)
- Updated copyright details.
- Fixed more Clang-Tidy static code analysis warnings in the code.
v1.13 (16 September 2019)
- Fixed a number of compiler warnings when the code is compiled with VS
2019 Preview
v1.12 (22 April 2019)
- Updated copyright details
- Updated the code to clean compile on VC 2019
v1.11 (2 December 2018)
- Updated copyright details
- Fixed a number of C++ core guidelines compiler warnings. These
changes mean that the code will now only compile on VC 2017 or later.
- Updated the sample app to compile against the Windows 10.0.11763.0
SDK which eliminates various VS compiler errors when the code is compiled
against earlier versions of the Windows 10 SDK.
- Changed all enum values to enum class
23 January 2018
- Added a number of missing files to the download. Thanks to Mikko Saariki
for reporting this issue.
v1.1 (24 June 2017)
- Provision of a number of new classes which provide a C++ object based
way of creating the XML for toast notifications instead of having to specify
XML text directly. This functionality is based on the UWP Community Toolkit
Notifications package. Currently these classes uses MSXML6 rather than the
UWP XML parser as I was unable to get the UWP parser to operate correctly.
If you know how to fix this, please let me know and I will look into
reworking the code.
v1.0 (3 June 2017)