I have a Windows Form application with a NotifyIcon. The application runs automatically on system startup, and shows its NotifyIcon and hides the form:
//InitializeComponent()
this.SysTrayIcon.Visible = true; //show notifyicon
this.SysTrayIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SysTrayIcon_MouseClick);
//...
this.Visible = false; //hide form
But for some reason, sometimes the NotifyIcon does not show in the notification area (system tray). This happens randomly, sometimes it shows up, sometimes it doesn't, and the application doesn't really do anything at startup, other than load config. The application itself starts up fine; I can see it running in Task Manager.
This issue does not occur when I start the application by running the exe manually, so it leads me to suspect that once in a while, the application loads up before some important resources and silently fails.
It seems that other people have this issue too, but so far nobody has really solved their problem (or my Google-fu isn't strong enough).
Any help would be appreciated, thanks.