Windows 8 Tray notification bug Windows 8 Tray notification bug windows windows

Windows 8 Tray notification bug


This is known bug in Windows. The only way you may be able to override the behavior of the taskbar is to find the handle of the balloon and then use SetWindowPos to make it topmost:

BOOL WINAPI SetWindowPos(  _In_      HWND hWnd,  _In_opt_  HWND hWndInsertAfter,  _In_      int X,  _In_      int Y,  _In_      int cx,  _In_      int cy,  _In_      UINT uFlags);

MSDN: "A window can be made a topmost window either by setting the hWndInsertAfter parameter to HWND_TOPMOST and ensuring that the SWP_NOZORDER flag is not set, or by setting a window's position in the Z order so that it is above any existing topmost windows. When a non-topmost window is made topmost, its owned windows are also made topmost. Its owners, however, are not changed." See SetWindowPos for more info.

Another strategy is to demote the taskbar. Use this code to find the topmost window:

HWND FindMyTopMostWindow(){    DWORD dwProcID = GetCurrentProcessId();    HWND hWnd = GetTopWindow(GetDesktopWindow());    while(hWnd)    {        DWORD dwWndProcID = 0;        GetWindowThreadProcessId(hWnd, &dwWndProcID);        if(dwWndProcID == dwProcID)            return hWnd;                    hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);    }    return NULL; }

Then demote the window or set the zorder of your window higher.


I had the same problem and discovered that the shape of the balloon depend on the size of the message body.Namely, if your message body has up to 60 chars, round-shaped balloon will be displayed, and for longer messages, new and standard square-shaped balloon will be used.

I am not using the PowerShell to interact with system tray, but WPF NiotifyIcon library for tray icon display within WPF apps.

HTH