You probably don't even need the form at all. VS.NET automatically adds a
form to the project and adds Application.Run (new Form1()) to the static Main
method, but it's often totally unnecessary for a NotifyIcon application.
Example below. Note that it uses Application.Run () without a form parameter,
and the icon events can manipulate the Application state directly.
class MyApp
{
static NotifyIcon icon;
[STAThread]
static void Main()
{
icon = new NotifyIcon();
icon.Icon = new Icon("App.ico") ;
icon.Text = "Tooltip text here";
icon.Click += new EventHandler(Ic on_Click);
icon.Visible = true;
Application.Run ();
}
static void Icon_Click(obje ct sender, EventArgs e)
{
if (MessageBox.Sho w("Quit now?", "NotifyIcon ",
MessageBoxButto ns.YesNo) == DialogResult.Ye s)
{
icon.Visible = false;
Application.Exi t();
}
}
}
"shagshag" <sh**********@c aramail.com> wrote in message
news:15******** *************** ******@phx.gbl. ..
I know how to place a notify icon in the system tray and
how to hide the Form that owe the icon. The taskbar entry
button is hidden, ok, but I always get an entry for the
Form when I press "Alt+TAB". See my pb ?