NO

Author Topic: ToastLib a plain C Toast notification library  (Read 4171 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
ToastLib a plain C Toast notification library
« on: November 21, 2023, 12:15:31 AM »
A plain C library to handle windows toast notifications.
Includes a console and a GUI sample demo.
This library is based on concepts derived from former work of Valentin-Gabriel Radu, but completely rewritten.
The main goal of the library is to hide the whole complex toast notification mechanisms inside library and making available to the user a couple of handles and few functions to register/unregister callback function and other 2 functions to create and destroy a notification manager.
The user must just supply the XML template for the toast in a memory string.
To speed-up compilation, and allow usage also un compilers that doesn't have windows runtime headers avalable, a condensated header is included will all required windows.runtime definitions. Also the runtime libraries, 32 and 64 bits versions, are supplied.

EDIT: Updated version and added VisualStudio project.

Download it from github.
« Last Edit: November 21, 2023, 10:58:40 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline Vortex

  • Member
  • *
  • Posts: 864
    • http://www.vortex.masmcode.com
Re: ToastLib a plain C Toast notification library
« Reply #1 on: November 21, 2023, 08:29:27 AM »
Hi Frankie,

Thanks, I managed to build and run the two examples on Windows 10. TestToastLib.exe expects 7 inputs from the user, is that OK?
Code it... That's all...

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: ToastLib a plain C Toast notification library
« Reply #2 on: November 21, 2023, 08:38:09 AM »
Hi Frankie,

Thanks, I managed to build and run the two examples on Windows 10. TestToastLib.exe expects 7 inputs from the user, is that OK?
Hello Erol,
Yes in the sample it emits 7 notifications as you can see in the loop:
Code: [Select]
/*
* Show some sample notifications.
*/
for (int i=0; i<7; i++)
{
if (!fToastSendNotification(hToast, wszText))
{
PostQuitMessage(1);
break;
}
Sleep(250);
}
I made this to check all functionalities during the debug, bat you can reduce the number if you want.
After the toasts are showed try to click everywhere inside one of them, then write down something and click send on the second. Then you can close the main app and repeat previous actions again. You'll see that the app restarts by itself.
The same happens with the GUI demo, only here you decide to show a toast.
You can change the dialog adding other inputs, controls, etc. simply modifying the XML template.
As you can see you don't need to interact at any level with windows runtime, but only use functions and handles.  ;)
To use toasts in your app you only need the library ToastLib.lib and the header ToastLib.h;D
« Last Edit: November 21, 2023, 08:44:17 AM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline John Z

  • Member
  • *
  • Posts: 860
Re: ToastLib a plain C Toast notification library
« Reply #3 on: November 21, 2023, 01:14:46 PM »
A plain C library to handle windows toast notifications.

Very very nice piece of work!

John Z