By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,341 Members | 1,396 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,341 IT Pros & Developers. It's quick & easy.

How to refresh System Tray in C#

P: n/a
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[i].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

Sep 6 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
>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 Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Sep 6 '06 #2

P: n/a

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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
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 !

Sep 6 '06 #3

P: n/a
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:
Mattias Sjögren wrote:
Can't you close the application in a more graceful way that lets it
clean up properly?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

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 !
Sep 6 '06 #4

P: n/a

sb*****@gmail.com wrote:
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:
Mattias Sjögren wrote:
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,

Sep 7 '06 #5

P: n/a
>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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Sep 7 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.