I mean when the user starts my application(exe). I want it to start directly in system tray, without showing the window. Like antivirus softwares & download managers, which start and run in the system tray silently.
I want the same effect and when user click the “show” button of the notifyIcon’s contextmenustrip then only application should show GUI.
I’m using this, but its not working
private void Form_Load(object sender, EventArgs e)
{
this.Hide();
}
May be I need to have Main() function in some other class which has no GUI but has notifyIcon & ContextMenuStrip whose option will instantiate the GUI window class. Right?
The way I usually setup something like this is to modify the
Program.csto look something like the following:Using this, you don’t need to worry about hiding instead of closing forms and all the rest of the hacks that can lead to… You can make a singleton form too instead of instantiating a new
Formevery time you click the show form option. This is something to build off of, not the end solution.