我正在使用NotifyIcon类来显示弹出窗口。当我使用Windows通知区域显示错误弹出窗口时,如何禁用默认声音?我需要从资源中播放自己的声音,但我不知道如何暂时禁用在windows主题中定义的声音。
我的代码示例:
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;
}
感谢您的合作。