473,406 Members | 2,345 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,406 software developers and data experts.

minimize application to sys tray

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

Thanks
Jun 6 '06 #1
8 4522
Avi,

Check out the NotifyIcon class. The about page for the class
documentation in MSDN has an example which will show you what you are trying
to do.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
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

Thanks

Jun 6 '06 #2
ok i found half way, this is the code that when i press double click on the
sys tray icon the application minimized

private void notifyIcon1_MouseDoubleClick(object sender,
MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
this.WindowState = FormWindowState.Minimized;

// Activate the form.
this.Activate();
}

now i want the code that if i press again double click on the sys tray icon
it will lunch back the application and if the application is lunch and i
press the sys tray icon again it will minimized, how i do it?

Thanks

"Nicholas Paldino [.NET/C# MVP]" wrote:
Avi,

Check out the NotifyIcon class. The about page for the class
documentation in MSDN has an example which will show you what you are trying
to do.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
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

Thanks


Jun 6 '06 #3
Hello Avi,

Just reverse operation

if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Normal;
AG> ok i found half way, this is the code that when i press double click
AG> on the sys tray icon the application minimized
AG>
AG> private void notifyIcon1_MouseDoubleClick(object sender,
AG> MouseEventArgs e)
AG> {
AG> if (this.WindowState == FormWindowState.Normal)
AG> this.WindowState = FormWindowState.Minimized;
AG> // Activate the form.
AG> this.Activate();
AG> }
AG> now i want the code that if i press again double click on the sys
AG> tray icon it will lunch back the application and if the application
AG> is lunch and i press the sys tray icon again it will minimized, how
AG> i do it?
AG>
AG> Thanks
AG>
AG> "Nicholas Paldino [.NET/C# MVP]" wrote:
AG>
Avi,

Check out the NotifyIcon class. The about page for the class
documentation in MSDN has an example which will show you what you are
trying to do.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
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
Thanks

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 6 '06 #4
i try your suggestion earlier but it cannot work like that

private void notifyIcon1_MouseDoubleClick(object sender,
MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
this.WindowState = FormWindowState.Minimized;
this.Activate();

if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Normal;
this.Activate();

}

if i try this it cannot minimized or normal because he do the code
together, any other suggestion

"Michael Nemtsev" wrote:
Hello Avi,

Just reverse operation

if (this.WindowState == FormWindowState.Minimized)
this.WindowState = FormWindowState.Normal;
AG> ok i found half way, this is the code that when i press double click
AG> on the sys tray icon the application minimized
AG>
AG> private void notifyIcon1_MouseDoubleClick(object sender,
AG> MouseEventArgs e)
AG> {
AG> if (this.WindowState == FormWindowState.Normal)
AG> this.WindowState = FormWindowState.Minimized;
AG> // Activate the form.
AG> this.Activate();
AG> }
AG> now i want the code that if i press again double click on the sys
AG> tray icon it will lunch back the application and if the application
AG> is lunch and i press the sys tray icon again it will minimized, how
AG> i do it?
AG>
AG> Thanks
AG>
AG> "Nicholas Paldino [.NET/C# MVP]" wrote:
AG>
Avi,

Check out the NotifyIcon class. The about page for the class
documentation in MSDN has an example which will show you what you are
trying to do.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...

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
Thanks

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 6 '06 #5
Hello Avi,

Check the current state and use only one case

private void notifyIcon1_MouseDoubleClick(object sender,MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Minimized;
}
else
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal
}

this.Activate();
}

AG> i try your suggestion earlier but it cannot work like that
AG>
AG> private void notifyIcon1_MouseDoubleClick(object sender,
AG> MouseEventArgs e)
AG> {
AG> if (this.WindowState == FormWindowState.Normal)
AG> this.WindowState = FormWindowState.Minimized;
AG> this.Activate();
AG>
AG> if (this.WindowState == FormWindowState.Minimized)
AG> this.WindowState = FormWindowState.Normal;
AG> this.Activate();
AG> }
AG>
AG> if i try this it cannot minimized or normal because he do the code
AG> together, any other suggestion
AG>
AG> "Michael Nemtsev" wrote:
AG>
Hello Avi,

Just reverse operation

if (this.WindowState == FormWindowState.Minimized) this.WindowState =
FormWindowState.Normal;

AG> ok i found half way, this is the code that when i press double
click
AG> on the sys tray icon the application minimized
AG>
AG> private void notifyIcon1_MouseDoubleClick(object sender,
AG> MouseEventArgs e)
AG> {
AG> if (this.WindowState == FormWindowState.Normal)
AG> this.WindowState = FormWindowState.Minimized;
AG> // Activate the form.
AG> this.Activate();
AG> }
AG> now i want the code that if i press again double click on the sys
AG> tray icon it will lunch back the application and if the
application
AG> is lunch and i press the sys tray icon again it will minimized,
how
AG> i do it?
AG>
AG> Thanks
AG>
AG> "Nicholas Paldino [.NET/C# MVP]" wrote:
AG>
Avi,

Check out the NotifyIcon class. The about page for the class
documentation in MSDN has an example which will show you what you
are trying to do.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Avi G" <Av**@discussions.microsoft.com> wrote in message
news:83**********************************@microsof t.com...
> 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
> Thanks

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jun 6 '06 #6
thanks it's working, now last question if i want to minimize the application
to the sys tray directly and not to the toolbar and be able to lunch it back
from the sys tray icon and minimize it back to the sys tray, how i do it?

"Michael Nemtsev" wrote:
Hello Avi,

Check the current state and use only one case

private void notifyIcon1_MouseDoubleClick(object sender,MouseEventArgs e)
{
if (this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Minimized;
}
else
if (this.WindowState == FormWindowState.Minimized)
{
this.WindowState = FormWindowState.Normal
}

this.Activate();
}

AG> i try your suggestion earlier but it cannot work like that
AG>
AG> private void notifyIcon1_MouseDoubleClick(object sender,
AG> MouseEventArgs e)
AG> {
AG> if (this.WindowState == FormWindowState.Normal)
AG> this.WindowState = FormWindowState.Minimized;
AG> this.Activate();
AG>
AG> if (this.WindowState == FormWindowState.Minimized)
AG> this.WindowState = FormWindowState.Normal;
AG> this.Activate();
AG> }
AG>
AG> if i try this it cannot minimized or normal because he do the code
AG> together, any other suggestion
AG>
AG> "Michael Nemtsev" wrote:
AG>
Hello Avi,

Just reverse operation

if (this.WindowState == FormWindowState.Minimized) this.WindowState =
FormWindowState.Normal;

AG> ok i found half way, this is the code that when i press double
click
AG> on the sys tray icon the application minimized
AG>
AG> private void notifyIcon1_MouseDoubleClick(object sender,
AG> MouseEventArgs e)
AG> {
AG> if (this.WindowState == FormWindowState.Normal)
AG> this.WindowState = FormWindowState.Minimized;
AG> // Activate the form.
AG> this.Activate();
AG> }
AG> now i want the code that if i press again double click on the sys
AG> tray icon it will lunch back the application and if the
application
AG> is lunch and i press the sys tray icon again it will minimized,
how
AG> i do it?
AG>
AG> Thanks
AG>
AG> "Nicholas Paldino [.NET/C# MVP]" wrote:
AG>
> Avi,
>
> Check out the NotifyIcon class. The about page for the class
> documentation in MSDN has an example which will show you what you
> are trying to do.
>
> Hope this helps.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mv*@spam.guard.caspershouse.com
> "Avi G" <Av**@discussions.microsoft.com> wrote in message
> news:83**********************************@microsof t.com...
>> 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
>> Thanks
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents
do not cease to be insipid." (c) Friedrich Nietzsche

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Jun 6 '06 #7
Avi G wrote:
thanks it's working, now last question if i want to minimize the application
to the sys tray directly and not to the toolbar and be able to lunch it back
from the sys tray icon and minimize it back to the sys tray, how i do it?

this.Hide() and this.Show()

<...>
JB
Jun 7 '06 #8
i managed to hide the application but not to restore it back, why what i
wrong with my code?

private void notifyIcon1_MouseDoubleClick(object sender,
MouseEventArgs e)
{

if (this.WindowState == FormWindowState.Normal)
{
this.Hide();
}

else
if (this.WindowState == FormWindowState.Minimized)

{

this.Show();

}

}

"John B" wrote:
Avi G wrote:
thanks it's working, now last question if i want to minimize the application
to the sys tray directly and not to the toolbar and be able to lunch it back
from the sys tray icon and minimize it back to the sys tray, how i do it?

this.Hide() and this.Show()

<...>
JB

Jun 7 '06 #9

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

Similar topics

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: pamelafluente | last post by:
Hello guys, I have done a small utility and would like that an image be displayed on the the windows tray (on bottom-right of the screen). Also I would like that when one clicks on X (close)...
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...
0
by: =?Utf-8?B?U2VudGhpbCBTdWJyYW1hbmlhbg==?= | last post by:
Our requirement is to run the vb dot net application in minimize mode with system tray icon in the remote machine (remote desktop). When we running in the remote desktop window is showing in...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.