469,951 Members | 2,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Notify tray Icon

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 ?
Nov 15 '05 #1
2 4530
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(Icon_Click);
icon.Visible = true;
Application.Run();
}

static void Icon_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Quit now?", "NotifyIcon",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
icon.Visible = false;
Application.Exit();
}
}
}

"shagshag" <sh**********@caramail.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 ?

Nov 15 '05 #2
Yeah ! Thanks a lot !
This was so simple. Backa Shagshag !!! =)

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by jm | last post: by
reply views Thread by Mike Eaton | last post: by
3 posts views Thread by iwdu15 | last post: by
3 posts views Thread by Cylix | last post: by
5 posts views Thread by =?Utf-8?B?cHJvZ2dlcg==?= | last post: by
1 post views Thread by ourxp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.