发生崩溃时是否有任何方法可以删除通知图标?

Tim*_*ell 1 c# winapi windows-xp winforms

有没有办法在发生崩溃时自动删除NotifyIcon?(我知道你可以用鼠标移除它)

我正在运行Windows XP.

Rob*_*Rob 5

对于C#,尝试从AppDomain处理UnhandledException事件,因此,在您的Main()方法中添加:

AppDomain.CurrentDomain.UnhandledException += 
    new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Run Code Online (Sandbox Code Playgroud)

然后添加以下方法:

static void CurrentDomain_UnhandledException(object sender, 
    UnhandledExceptionEventArgs e)
{
    // .... Remove Notification icon here
}
Run Code Online (Sandbox Code Playgroud)