 |
|
 |
Hello Luc Pattyn,
First of all thank you very much for this wonderful program, it works fine.
I put the trayiconbuster.exe file it in the autostart folder so that it starts with windows,
though after about 1 hour a window called "Form1" with the button "Remove Obolete Tray Icons"
appears. When i click on the button the program closes entirely, just like when i close the program manually,
this really gets pretty annoying because that window appears than every half an our.
All I want is that window never to appear.
I would be thankful for help.
Nat
|
|
|
|
 |
|
 |
Hi,
the app has a single main form (the one you are complaining about), which normally is Minimized and not shown in the task bar, hence invisible. Initially, i.e. during development, it was permanently visible (WindowState.Normal) and the button was used to test the code. With the form minimized, the app works as intended. AFAICT there is no code that changes the form's visibility, windowstate, or locaion.
There also is nothing with a period of one hour or half an hour. So if the form pops up after such time, my best guess is you have something else that modifies my app's WindowState.
Possible work-around: you could modify the form's Location to some negative numbers (say -10000,-10000) to make it off-screen.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
 |
|
 |
Hi,
now I changed the Location values of Form1 both to -10000, like you said, it went off-screen.
I also removed the tray icon in the Form1.Designer.cs by setting "this.notifyIcon1.Visible = false;"
But when you press Alt + Tab in Windows, the App is still in the 'Task Switcher' listed with the other tasks.
How can I make it also disappear from the Task Switcher? (I'm using Win 7 64-Bit)
Thank you,
Nat
|
|
|
|
 |
|
 |
I haven't tested this, however Google tells me it suffices to set the form's FormBorderStyle property to FixedToolWindow.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
 |
|
 |
wow this works flawless Thanks
|
|
|
|
 |
|
 |
It solved a problem that I had with a third party application leaving icons in the tray - saved me tons of work. Many thanks
|
|
|
|
 |
|
 |
I was told Windows 7 has new features, one of them being identical try icons somehow get collected, merged, I don't know the details, except that the "group icons in tray" feature can be disabled. When it is not disabled and icons do get grouped, my app is no longer capable of removing them.
As I don't have Windows 7 around at this time, I can't do anything about it yet. I will look into the matter at some later point in time (probably medio 2010).
Please feel free to provide me with more information if and when available.
Cheers.
modified on Friday, August 28, 2009 6:10 AM
|
|
|
|
 |
|
 |
hi,
i just noticed that each time a stale icon is removed, an empty space (probably equal to size of an icon) is left near the clock, so everytime i delete an icon, some free space is left and the traysize isn't reduced. I didn't notice this previously, just noticed it and wanted to ask if you have worked on this issue too. The space is removed when you make a change to system tray (eg change the size or add another icon etc)...
Thankyou
|
|
|
|
 |
|
 |
I've never seen such thing. What operating system and version/service pack are you using?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
 |
|
 |
I have the same problem. Windows Vista SP2
-----
Samara, Russia
|
|
|
|
 |
|
 |
I've never seen that, and as long as it doesn't happen on my Vista machine I'm afraid there isn't much I can do. What program(s) is(are) putting up those NotifyIcons that don't get removed properly?
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
 |
|
 |
Great Application.
I need to delete an icon from the system tray. I found this application very interesting but to be honest, i am unable to understand even a line in code. You should have provided more explanation of the article. I am unable to understand how an icon with out an image name is deleted. The code and application is no doubt develped by one of the best out there but can u please provide some help in understanding it. I need to delete a process icon . Befor killing the process , can i get a ptr to it and then delete its icon.
Thanks
|
|
|
|
 |
|
 |
Hi,
the goal of the tool was to delete stale icons, i.e. icons for which no process existed any more.
It was and is intended as a tool, to be used; not as a programming example, so I left out a lot of explanation on how to get to the right window, etc etc.
the main sequence of events (in TrayIconBuster.cs) is like this:
1. locate the toolbar that holds all the notify icons, that is what the series of FindNestedWindow calls is about;
2. enumerate all buttons in the toolbar in order to find at least one icon with a live process (could be the tool itself); this is a safety precaution, in case another Windows version does things differently, I don't want to go and change things in an environment I don't recognize; so pass 1 is looking for icons with a process name ending on ".exe".
3. assuming pass 1 succeeds, I enter pass 2 enumerating all buttons again; the ones without process name are the stale ones, and now get sent a TB_DELETEBUTTON message.
So the active code is in here:
if(pass==2 && filename==null) {
SOK=(uint)SendMessage(hWnd, TB_DELETEBUTTON,
new IntPtr(item2), IntPtr.Zero);
if(SOK!=1) throw new ApplicationException("TB_DELETEBUTTON failed");
removedCount++;
}
If you were to change anything, it should be there.
However you say you want to delete a notify icon for a running process; I am not sure that is wise; the process itself will not know. The icon will disappear, and so will the ability to invoke the context menu if any. Anyway, if the app exits, it removes its icons; and if the app gets killed somehow, my tool would remove the icon without requiring any change. So I am not convinced you need to change anything.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
 |
|
 |
Hi, Thanks for replying
You said "I don't want to go and change things in an environment I don't recognize". This is exactly my problem. I have a 3rd party application installed that has leaks in disconnect. That is when i connect to this program and then disconnect, it doesnot free all of its resources. After some days the 3rd party application crashes,One work around is to stop(kill) the process(3rd party) after it has made all backups and restart it. (if you hav better idea than this, please share... ).
Now, when i kill the process (in my C# application), its icon still remains, which is kind of bothering me. I want to remove the icon too, but again i don't want to look for other stale processes. All i want to do is, take a handle to the process that i am gonna kill, then kill the process and somehow use the handle to remove the icon.
Hope you will provide further help.
Thankyou
|
|
|
|
 |
|
 |
Yes, that is what I was expecting.
My recommendation would be to:
1. kill the app you want to get rid of (manually, by batch file, by an app, whatever);
2. keep my TrayIconBuster running all the time, it will periodically (every 5 seconds) clean up the stale icons; having them around a few seconds won't hurt anyone, and my app is small, so that shouldn't disturb anything. Having it clean up other stale icons than the ones that interest you, is no bother either, they are stale, there is no process attached to them, so all they do is take screen real estate and some memory.
So there is no need to change anything nor create a (modified) app.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
 |
|
 |
Ok...
Great!!!
I wonder why i wanted to modify the application. You are right, A stale icon has no process , they should be removed...
I think, i am confused. well honestly, i wanted to learn ... I have already installed your application and it works great ...
Thankyou very much...
|
|
|
|
 |
|
 |
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
 |
|
 |
WHAT?! No code snippets?? What kind of garbage are you posting here?!
Otherwise a great little article!
|
|
|
|
 |
|
 |
Thanks Dave.
And yes there is one snippet, however using ellipsis judiciously my code is so compact you may look over it.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
 |
|
 |
A very interesting article Luc, and very much appreciated. Thank you.
jase.
|
|
|
|
 |
|
 |
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
 |
|
 |
I really appreciate your help. I have been trayed for several days what you showed us.
Thank you so much.
|
|
|
|
 |
|
 |
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
 |
|
 |
Say for example I have a Image Process Name 'Logitray.exe'
Could you tell me a way to restart it in C#?
Same as going to Taskmanager and end process 'Logitray.exe' and then open the shortcut 'Logitray.exe' from desktop.
Thats all i plan to create in my application.
Thanks,
Pranay
Pranay Sharma
Web Analyst
Future Strategies Inc.
http://www.pranaysharma.com/
|
|
|
|
 |
|
 |
Hi,
1.
I fail to see how this relates to phantom notify icons.
2.
killing a process is not a very good idea, since you don't know in what state it will
leave its environment (It may have created temporary files, written but not closed
an output file, etc); KillProcess is a last resort only.
3.
STarting a process is easy in .NET; have a look at the Process class; simple things can
be done with a simple Process.Start(). More complex stuff is possible by manipulating
its ProcessStartInfo property.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
 |