Sergei B.
Sergei B.

Reputation: 3227

Disable default sound when showing error notification

I'm using NotifyIcon class to show the popup. How can I disable default sound when I'm showing error popup using windows notification area? I need to play my own sound, from resources, but I don't know how to temporarily disable sound which is defined in windows theme.

My code sample:

    public void Notify()
    {
        if (_icon != null)
            return;

        if (!Settings.Default.EnableTrayNotifications)
            return;

        _icon = CreateNotifyIcon(LoadIcon());
        _icon.Visible = true;
        _icon.ShowBalloonTip(Settings.Default.MinimumNotificationInterval);
    }

    private NotifyIcon CreateNotifyIcon(Stream iconStream)
    {
        var icon = new NotifyIcon
                    {
                        Icon = new Icon(iconStream),
                        BalloonTipIcon = ToolTipIcon.Error,
                        BalloonTipTitle = "Sometext",
                        BalloonTipText = "Sometext"
                    };
        icon.BalloonTipClicked += (s,a) => ShowWindow();
        icon.BalloonTipClosed += (s,a) => Cleanup();
        return icon;
    }

Thanks for cooperation.

Upvotes: 3

Views: 2200

Answers (1)

L.B
L.B

Reputation: 116188

You don't need to disable default sound. You can create your own forms and play sounds. See this link or this for ex.

Upvotes: 1

Related Questions