"deciacco" <a@awrote in message
news:GO******************************@giganews.com ...
>I have a NotifyIcon application. (c# 2) I want to be able to catch a
kill/shutdown attempt so that I can call Dispose() to remove the icon. I
tried to create an event handler for ApplicationExit and put my icon
dispose call in there, but when process.kill() is called from an outside
app on the notifyicon app, the event doesn't get raised. the app closes but
the icon remains in the tray as dispose was never called.
any ideas?
another way of telling the notifyicon class that it needs to close?
If TerminateProcess is called, which I guess is what Process.Kill probably
does, *no more code in the targetted process gets to run*. I just had to
work around this problem myself (process being killed, not using NotifyIcon)
and did so by having another process waiting on the process handle of the
first which is signalled when the process ends for any reason, triggering my
cleanup. Not sure how or even if you can do out-of-process cleanup with
shell notification icons though.
>
Thanks.