goodmorningsky Posted January 30, 2004 Posted January 30, 2004 I'm using NotifyIcon for my application to be shown in system tray. However when it starts the app's tray comes out 1 ~ 3 tray. More than 1 tray comes out on system tray --> it's problem. But, When I mouse over on system tray only one tray of my app remains. And when I terminats the app, the tray doesn't disappear until I put mouse on the system tray. I think it's refresh problem. Why this happens with .NET NotifyIcon? All other applications on my comp doesn't give this problem. Is there a way fix this problem? PS: I'm using Win2000. Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
Leaders dynamic_sysop Posted January 30, 2004 Leaders Posted January 30, 2004 when closing your application down , set the NotifyIcon's Icon to Nothing. eg: '/// in your closing sub... With NotifyIcon1 .Icon = Nothing .Dispose() End With you can also set the Visible property to False if needed. Quote
Administrators PlausiblyDamp Posted January 30, 2004 Administrators Posted January 30, 2004 How are you terminating your application? If your app shuts down cleanly then the icon should be removed. Also when you say 1 - 3 icons appear on startup are some of these left over from previous runs of the app? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
goodmorningsky Posted January 30, 2004 Author Posted January 30, 2004 Thank you for reply. I'm adding my solution.. mnuExit is menu item in ContextMenu in NotifyIcon. One tip I found is: You should call Application.Exit() before this.notifyIcon.Icon = null; this.notifyIcon.Dispose(); Otherwise your application process will not be terminated!! private void mnuExit_Click(object sender, System.EventArgs e) { if(MessageBox.Show(null, "Do you want to close all service and exit?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.StartStopAllServices(false); Application.Exit(); this.notifyIcon.Visible=false; this.notifyIcon.Icon = null; this.notifyIcon.Dispose(); } } Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
samsmithnz Posted January 30, 2004 Posted January 30, 2004 I always thought this was Windows 2000.... Quote Thanks Sam http://www.samsmith.co.nz
kingelessar Posted January 31, 2004 Posted January 31, 2004 I'm not that experienced, but I don't understand why your system tray icon doesn't disappear when your form closes. This code: Application.Exit(); this.notifyIcon.Visible=false; this.notifyIcon.Icon = null; this.notifyIcon.Dispose(); doesn't make any sense I think, because first you exit the application and then you try to hide the icon... ??? When my system tray icon doesn't go away, i always place this.notifyIcon.Visible = false; this.notifyIcon.Dispose(); in the Closing event of the form. Dennis Quote Anon - "If you can't beat your computer at chess, try kickboxing." homepage: http://www.givemehelp.co.uk/
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.