473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Minimize to sys tray

Hi... how can i make my application when minimized go to system tray???

[]s...
Nov 16 '05 #1
2 3523
I think u can use a NotifyIcon from System.Windows.Form ,,and add that to ur
application

"Ricardo" <r_******@hotmail.com> wrote in message
news:uL**************@TK2MSFTNGP10.phx.gbl...
Hi... how can i make my application when minimized go to system tray???

[]s...

Nov 16 '05 #2
You need to do this (you can change the defined names for these, but for
tutorial sake, use what I have stated below until you get the hang of it):

Add a context menu to your form called "IconMenu"
Create two options in this menu. Once called "MenuOpen" the other
called "MenuExit"

in your form constructor add this:
this.SizeChanged += new EventHandler(Form1_SizeChanged);
this.MenuOpen.Click += new System.EventHandler(this.MenuOpen_Click);
this.MenuExit.Click += new System.EventHandler(this.MenuExit_Click);


now add this code to the form class:
public NotifyIcon TrayIcon;
private bool Shown;

private void Form1_SizeChanged(object sender, System.EventArgs e)
{
if (Shown & this.WindowState == FormWindowState.Minimized)
{
Shown = false;
this.ShowInTaskbar = false;
TrayIcon.Visible = true;
}
}

private void MenuOpen_Click(object sender, System.EventArgs e)
{
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
Shown = true;
TrayIcon.Visible = false;
}

private void MenuExit_Click(object sender, System.EventArgs e)
{
TrayIcon.Visible = false;
this.Close();
System.Environment.Exit(0);
}
and finally add this to your Form1_load event:
TrayIcon = new NotifyIcon();
Shown = true;
TrayIcon.Visible = false;
TrayIcon.Icon = this.Icon;
TrayIcon.Text = "Aplication Running...";
TrayIcon.ContextMenu = this.IconMenu;
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Austin | last post by:
I wrote a GUI program with wxPython. In the window, there are 3 attributes on left top. "_" could let the program to minimize to tool bar. I want to let the program minimized to the system tray....
2
by: varadha | last post by:
Hi, i want to create a VC++ application that minimizes to system tray when i minimize it. This application should be running in the background and doing it process(Just like Yahoo messanger...
4
by: mphanke | last post by:
Hi, how can I minimize an application to the tray? Snippets welcome. Martin
1
by: Xarky | last post by:
Hi, I followed the follwoing post to minimize application to system tray....
3
by: Maka Sili | last post by:
Hi, My VC++ application does not have a titlebar (and therefore no System menu, no minimize, no maximize and no close button). We have a custom button for minimize and close. When the app...
4
by: steve | last post by:
hi all, i was wondering how is it possible to add an extra box ( i think they are called boxes: upper right corner ...) in a form that will minimize it in the system tray? You know some...
5
by: Yancey Jones | last post by:
I am looking for some example code for minimizing a 3rd part app to the system tray. I am working on writing a service to control VMWare and when a user logs in, I would like to minimize the VMWare...
8
by: Avi G | last post by:
Hi, i've created an application and i want it to be minimized to the sys tray, how i do it? if you can direct me step by step even with create a small application and put it in the sys tray ...
1
by: zakhirn | last post by:
Anyone have code that creates a button that will Minimize Excel to the system tray. I do not need anything complicated like changing the minimize button or the close button to a minimize to...
3
by: Jimmy | last post by:
I'm kinda newbie to python and wxPython. Now I'm confronting a thorny problem: how can I make my program minimize to the taskbar represented as an ico, and when there is some message from network...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.