How to refresh System Tray in C#

  • Thread starter Thread starter bipi
  • Start date Start date
B

bipi

Dear everyone,

In my application, I kill process by:

private bool KillProcess(String processName)
{
bool result = false;
Process[] process =
Process.GetProcessesByName(processName);
for (int i = 0; i < process.Length; i++)
{
Process.GetProcessById(process.Id).Kill();
result = true;
}
return result;
}
this process will be killed, but an icon of this process still at
system tray until it is repained. Please show me the solution to
refresh System Tray.

Many thanks,
bipi
 
this process will be killed, but an icon of this process still at
system tray until it is repained. Please show me the solution to
refresh System Tray.

Can't you close the application in a more graceful way that lets it
clean up properly?


Mattias
 
Mattias said:
Can't you close the application in a more graceful way that lets it
clean up properly?


Mattias

This problem's the same as you are running MS OutLook and the icon of
Outlook will show in system tray but when you use "Windows Task
Manager" to "end process" outlook, the outlook icon still at System
Tray. Please help me !
 
What if you add an icon to the tray and then remove it correctly?
I think this will cause the tray to refresh...

bipi a scris:
 
What if you add an icon to the tray and then remove it correctly?
I think this will cause the tray to refresh...

bipi a scris:

Hey you, I try to do it which solution you give me. I put NotifyIcon in
my application and after kill process A(A is process name), I show my
icon and hide it later. The icon of process A is still at system tray.
But when I move mouse over this icon, it disappears immediately.

Do you have any ideas ! please show me !

Many thanks,
 
This problem's the same as you are running MS OutLook and the icon of
Outlook will show in system tray but when you use "Windows Task
Manager" to "end process" outlook, the outlook icon still at System
Tray.

That's why I'm questioning your need to kill the process. There are
usually better ways to close an application.


Mattias
 
Back
Top