How to avoid application killing while have NotifyIcon active?

  • Thread starter Thread starter Andrew Nugged
  • Start date Start date
A

Andrew Nugged

When I am teach my small tool to sit as NotifyIcon and make my main
window this.Hide() it's all okay - but when I popped up again, and
window is active and I ask some other programs to close all programs
(and also Settings->Memory->Running programs->Stop All->EndTask) my
program is killed... But I don't want to - I want it to hide window on
this and still be in tray...

and, by the way - after killing program there's empty icon place in
tray are still busy and when I am running my program again - icon
appears next to this empty but busy place... and those places are
cleared only, of course, after reset...

Please advice me...
 
Well, if the other application is using TerminateProcess, there's *nothing*
you can do; your application is dead and that's all there is to it. If
you're getting a CLOSE message from that other program that's trying to
close everything, you could, instead of closing, hide your form again. We
can't remotely diagnose what's going on unless you know more about this
second program that's closing things or unless you can check and see what
messages are sent to your form when it tries to close you...

Paul T.
 
yes, on close message my program follows this.close() and other steps
and minimizing byself with this.Hide() and returns Cancel event, but,
for example, SPB Pocket Plus tries to close and see so app is minimized
and then do gracefull, peaceful, freindly, mmm... killing...

Anyway - if such kill is unavoided, how correctly to take back
NotifyIcon from tray& (to be correct: only that's icon empy but busy
space, icon image byselfs goes out from memory with app as resourse)..

Cause after such killing when I run my app again - it's icon appears on
one empty place to left in tray ("lost" empty space from previous
kill)...

Any suggestions?
 
When your application exits, it should remove the task bar icon. Without
knowing how you are adding it, exactly, I can't tell you how to remove it.
If spb Pocket Plus is using TerminateProcess(), I don't know of any way to
clean up after that. You might try a Finally clause in a Try block in the
Main routine of your application or something of that sort...

Paul T.
 
Back
Top