Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Win toast / balloon notifications stopped working recently on windows 10 with Qt
Forum Update on Monday, May 27th 2025

Win toast / balloon notifications stopped working recently on windows 10 with Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsystemtrayiconshellnotifyicotoastballoon-notific
5 Posts 4 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zwoelfer
    wrote on 13 Dec 2019, 11:45 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 13 Dec 2019, 22:11 last edited by
      #2

      Hi,

      Does it work for you if you call the native API directly in your application ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 14 Dec 2019, 09:11 last edited by
        #3

        Hi
        tried your code (Qt 5.12.6) in winVer1803 which is rather old now.
        I didnt update to 1903 as had many issues at work with it.

        No toast was shown using your code. ( I did assign valid icon)

        So in what version did you actually see that code work ?

        Z 1 Reply Last reply 19 Dec 2019, 11:50
        0
        • M mrjj
          14 Dec 2019, 09:11

          Hi
          tried your code (Qt 5.12.6) in winVer1803 which is rather old now.
          I didnt update to 1903 as had many issues at work with it.

          No toast was shown using your code. ( I did assign valid icon)

          So in what version did you actually see that code work ?

          Z Offline
          Z Offline
          zwoelfer
          wrote on 19 Dec 2019, 11:50 last edited by
          #4

          @mrjj said in Win toast / balloon notifications stopped working recently on windows 10 with Qt:

          Hi
          tried your code (Qt 5.12.6) in winVer1803 which is rather old now.
          I didnt update to 1903 as had many issues at work with it.

          No toast was shown using your code. ( I did assign valid icon)

          So in what version did you actually see that code work ?

          I saw the code work on Windows 10 Enterprise winVer1803 in August. Now still on winVer1803 (with hotfixes KB4512576, KB4516115, KB4521861, KB4523203, KB4525237 installed in the meantime) it's not working as I said. But recently I tested the code on Windows 10 winVer1903, and it worked on Qt 5.7 and Qt 5.12, the test notification was showing up! It doesn't make any sense to me. I might have to try using the new Windows 10 api to post the notifications, which is ugly or maybe impossible with using Visual Studio 2015.

          G 1 Reply Last reply 8 Jun 2023, 08:05
          1
          • Z zwoelfer
            19 Dec 2019, 11:50

            @mrjj said in Win toast / balloon notifications stopped working recently on windows 10 with Qt:

            Hi
            tried your code (Qt 5.12.6) in winVer1803 which is rather old now.
            I didnt update to 1903 as had many issues at work with it.

            No toast was shown using your code. ( I did assign valid icon)

            So in what version did you actually see that code work ?

            I saw the code work on Windows 10 Enterprise winVer1803 in August. Now still on winVer1803 (with hotfixes KB4512576, KB4516115, KB4521861, KB4523203, KB4525237 installed in the meantime) it's not working as I said. But recently I tested the code on Windows 10 winVer1903, and it worked on Qt 5.7 and Qt 5.12, the test notification was showing up! It doesn't make any sense to me. I might have to try using the new Windows 10 api to post the notifications, which is ugly or maybe impossible with using Visual Studio 2015.

            G Offline
            G Offline
            Grigg_23
            wrote on 8 Jun 2023, 08:05 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved