Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows notification created with NotifyIcon shows "microsoft.explorer.notification" and GUID

Tags:

c#

wpf

notifyicon

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?

like image 505
Robert N Avatar asked Apr 19 '19 19:04

Robert N


1 Answers

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.

like image 168
Alsch Avatar answered Oct 21 '22 06:10

Alsch