5

We have written a WPF desktop application for Windows. The application launches on start-up and mostly runs in the background, but has a UI which is accessible via the system tray. Occasionally the app needs to notify the user of something, and so for this, we use the NotifyIcon library to generate notifications. Here is the relevant code:

XAML:

<mui:ModernWindow
    ...
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:tb="http://www.hardcodet.net/taskbar" 
    ... >

    <tb:TaskbarIcon
            x:Name="MyAppIcon"
            ...
    </tb:TaskbarIcon>
</mui:ModernWindow>

C# code behind:

using Hardcodet.Wpf.TaskbarNotification

public void ShowStartupBalloon(string message)
{
    // show balloon with built-in icon ie 'Info'
    MyAppIcon.ShowBalloonTip(Properties.Resources.App_Title, message, BalloonIcon.Info);
}

The notifications appear as small floating windows near the taskbar, but (sometimes, not always) they include the string "microsoft.explorer.notification" and GUID.

Notification message showing undesirable text and GUID

We would like to eliminate these as they are confusing our customers; many think some kind of error in the software has occurred. Does anyone know how to suppress that in order to display only the text of the notification we have supplied?

Robert N
  • 1,156
  • 2
  • 14
  • 32
  • Did you find a solution to this? I am having the same issue sporadically with a winform app. – Steve0212 Jun 28 '19 at 16:23
  • @Steve0212 No, still having this issue. – Robert N Jul 15 '19 at 23:13
  • 1
    Have you tried to update both Windows and `Hardcodet.NotifyIcon.Wpf` package? I am not having this issue with a simple standalone application containing only a `TaskbarIcon`. It ca be related to windows itself or something wrong the application is doing in the background or while installation. – Cfun May 14 '20 at 21:08

3 Answers3

5

I've experienced this problem as well. From what I've gathered, that bottom text is Microsoft's way of making sure that a user knows the source of a notification, and that random programs can't impersonate a genuine windows notification. The inclusion of a ToolTipIcon (in your case the info icon) seems to trigger this.

As a result, you can remove that text completely by not specifying a BalloonTipIcon, either by not defining the property at all, or defining it as None:

MyAppIcon.ShowBalloonTip(Properties.Resources.App_Title, message, BalloonIcon.None);

The only tradeoff, of course, is that your notification won't have an icon.

Hope this helps.

Alsch
  • 61
  • 1
  • 3
0

Show icon with automatic timeout:

public static void ShowBalloon(string title, string body)
{
    // Show with icon
    NotifyIcon ni = new NotifyIcon() { Visible = true, Icon = Properties.Resources.Icon};

    // Timeout is deprecated since Vista
    ni.ShowBalloonTip(0, title, body, ToolTipIcon.None);

    // Dispose on event
    ni.BalloonTipClosed += (sender, e) => ni.Dispose();
}
Beni
  • 1
0

Microsoft.Explorer.Notification text is shown due to immediate disposal of NotifyIcon object.

So basically if you call

MyAppIcon.ShowBalloonTip(5000);
MyAppIcon.Dispose();

you get the Microsoft.Explorer.Notification.{GUID} instead of AppName in the notification title.

To fix that avoid direct disposal and use what Beni proposed:

MyAppIcon.BalloonTipClosed += (sender, e) => MyAppIcon.Dispose();