To me it seems windows balloon messages stopped working completely some weeks ago on windows 10. In August 2019 the following code based on Qt could be used to post a notification in the windows action center, and letting a toast pop up with that notification:
#include <QApplication>
#include <QSystemTrayIcon>
int main(int argc, char **argv)
{
QApplication app( argc, argv );
//create a notification icon, and post a test notification
QSystemTrayIcon *trayTest = new QSystemTrayIcon();
trayTest->setIcon( QIcon( "path-to-some-icon-resource" ) );
trayTest->show();
trayTest->showMessage( "Hello", "world" );
return app.exec();
}
But now out of the blue QSystemTrayIcon::showMessage stopped having any effect at all, and nothing is showing up anywhere. A systray application at work is using that method, and windows notifications stopped working on all systems (with windows 10 installed). QSystemTrayIcon::showMessage isn't working with Qt 5.7, Qt 5.12 and Qt 5.13. I had a look on the source of Qt 5.7, and internally Shell_NotifyIcon is called in qsystemtrayicon_win.cpp:
bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
{
NOTIFYICONDATA tnd;
memset(&tnd, 0, notifyIconSize);
qStringToLimitedWCharArray(message, tnd.szInfo, 256);
qStringToLimitedWCharArray(title, tnd.szInfoTitle, 64);
tnd.uID = q_uNOTIFYICONID;
tnd.dwInfoFlags = iconFlag(type);
tnd.cbSize = notifyIconSize;
tnd.hWnd = m_hwnd;
tnd.uTimeout = uSecs;
tnd.uFlags = NIF_INFO | NIF_SHOWTIP;
return Shell_NotifyIcon(NIM_MODIFY, &tnd);
}
Shell_NotifyIcon is used across different versions of Qt for the windows implementation of showMessage. I verified that Shell_NotifyIcon was called when calling QSystemTrayIcon::showMessage under Qt 5.7, it returned 1 like it should if no errors had occurred, and no notification was showing up. Playing around with the "Focus assist" and "Notifications & actions" settings had no effect.
Have there been windows updates recently modifying the behavior of windows notifications? Is it only possible to post notifications with some new native windows 10 apis? I couldn't find anything concerning windows updates and notifications not showing anymore.