Running a vb.net applcation fron the system Tray icon

tany

Member
Joined
May 15, 2006
Messages
5
Programming Experience
Beginner
Hi..All,

I have done a VB.net application.All I want is that it should run from the sytem tray icon which I have given.The application runs from the system tray but the things which I want to do is,

1.How to maximize the application when the user double clicks the icon in the system tray.
2.When the user clicks the close button of the form,the application should stay minimized in the system tray (but should be running until the user logs out)
3.And when the user logs out of the application, I still want the application to be shown(with the icon which I've given) in the system tray(but not running)
4.Also I want to give the user some option when he right clicks the icon in the system tray to maximize or sign out ..etc.

Overall I want my application to work how the MSN works from the system tray.

I don't know if I'm clear with whatever I have asked,I hope I'm making sense.

Pls help if you know this,

Thanks in advance.
 
1. Handle the DoubleClick event of the NotifyIcon and set the WindowState of the form to Maximized.
2. That is not simple because you have to prevent the app from closing when it wants to. You have to make sure that you test whether the system is shutting down and if so allow the app to close or else your app will never close and the system will be unable to shut down. I'll get back to you on that one.
3. If the app is not running then the icon is not in the system tray. if the icon is in the system tray then the app is running. You cannot have it both ways. You can't show something if it's not there.
4. Create a ContextMenu with the desired menu items and assign it to the ContextMneu property of the NotifyIcon.

May I suggest that you actually read the help/MSDN topics for the NotifyIcon and its member listing. Most of this information would have been provided there.

http://msdn.microsoft.com/library/d...lrfsystemwindowsformsnotifyiconclasstopic.asp
http://msdn.microsoft.com/library/d...fsystemwindowsformsnotifyiconmemberstopic.asp
 
Hi..Thanxs for your help.

Will you please help on the topic on closing the applcation.
I mean when I close it should stay minimized in the system tray...

If you could help on this..

Thanxs again for answering
 
Thanxs for your reply Kulrom.

But what I want to do is When the user clicks the close button of the form,the application should stay minimized in the system tray icon (but should be running until the user logs out)

Thanxs
 
Hi..

I have got what I was looking for, I mean the applcation gets minimized into the system tray icon when we click the close button.

Thanxs all for your help.

My last problem, I don't know if it is possible to show the icon in the sytem tray when my application is not running with a cross mark over it which will show that the user is not signed in.And when the user double clicks on that icon , it should show the first login form.

Is it possible??
Pls help if you know this,
Thanxs
 
If the 1st login form is start page then it would display it by default this page. Otherwise, use doubleClick event. namely NotifyIcon1_DoubleClick suppose to pop up any other form which is set as startup form. Then from this form you should check if the user is logged or not. Depends on result show the loggin form and hide/close the previous form or leave it to running if user was already loged in.

Regards ;)
 
tany said:
Hi..Thanxs for your help.

Will you please help on the topic on closing the applcation.
I mean when I close it should stay minimized in the system tray...

If you could help on this..

Thanxs again for answering

can you remove or disable the close button on the form, so that only the minimize button can be used? this allows you to keep the ability to quit the program while preventing anything other than minimizing

i know some apps minimize on close.. it's just a case of.. is it worth it?

read this, for an answer to all your questions:
http://channel9.msdn.com/ShowPost.aspx?PostID=51196
 
cjard,
It seems like you do not read all posts ... take a look at the post #6 and you'll see nothing but the same procedure which cancel closing while you can add a code to set window state to minimized (except if you mind cuz it was pseudo code).
Also notice that hiding or disabling close button box is not very good idea. Actually if it was acceptable don;t you think MSN would do that? Ain't that right?

Regards ;)
 
kulrom said:
cjard,
It seems like you do not read all posts ...
often true

take a look at the post #6 and you'll see nothing but the same procedure which cancel closing while you can add a code to set window state to minimized (except if you mind cuz it was pseudo code).
the link to the discussion i posted, was a little more in-depth than the pseudo code posted in #6. i'll forgive you if you didnt read all the posts.. :D

Also notice that hiding or disabling close button box is not very good idea.
i agree

Actually if it was acceptable don;t you think MSN would do that? Ain't that right?

actually, i dont rate any app that minimizes on close as acceptable. close is for closing the application, minimize is for minimizing it.. just because MSN does minimize on close, does that make minimize-on-close acceptable?
 
actually, i dont rate any app that minimizes on close as acceptable. close is for closing the application, minimize is for minimizing it.. just because MSN does minimize on close, does that make minimize-on-close acceptable?
Well, if i am not wrong he/she is looking for solution that looks like MSN
tany said:
original thread: ... Overall I want my application to work how the MSN works from the system tray

lol ... obviously you dont read the posts entirely. Anyway thanks for the comments ;)
 
Back
Top