473,385 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to refresh System Tray in C#

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
5 9798
>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

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
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

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
>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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: elziko | last post by:
If I **HAD** to use Process.Kill to end an application that I had no other control over. This application leaves an icon in the system tray. Is there any way in code to force WIndows to refresh...
1
by: balu | last post by:
Hello , I Had a problem in developing a application for getting a message over or above system tray . When we first logon into the yahoo messenger , whenever a new user logon ,The messenger...
3
by: Nicolas Poirier | last post by:
I successfully made a system tray application. When I do shut down the computer, how does the computer can instruct my application to shut down? For the moment, if I don't quit my application,...
3
by: joe | last post by:
Hi guys, Is there any way to refresh the system tray. Every time the explorer crashes the notify icons are removed and I cannot see them when it comes back even when my application is running....
10
by: Crouchie1998 | last post by:
Hello To All You Real Programmers Out There!! There is an application called: "Tray It" Webpage: ---------- http://www.teamcti.com/trayit/trayit.htm Direct Download:
2
by: Oenone | last post by:
I've a little piece of code that I sometimes need to use that kills a running process when it stops responding. The process has a notification icon that it displays in the system-tray area of the...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
1
by: =?Utf-8?B?RW5naW5lZXJpaw==?= | last post by:
I have an application which uses a notification icon in the system tray. When the application is closed the notification icon remains in the system tray until I hover over it with the mouse. How...
3
by: Usman Jamil | last post by:
Hi I've a windows application that does a lengthy backup process. While the process is going on, I need to show a progress bar inside system tray or just above the system tray. Can someone...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.