I have a seperate function for initializing the Context Menu, but it's basically this:
private void InitializeContextMenu()
{
ctxMenu.MenuItems.Add( new MenuItem("lauch", new EventHandler(launch)));
ctxMenu.MenuItems.Add( new MenuItem("Check Now", new EventHandler(CheckNowEvent)));
ctxMenu.MenuItems.Add( new MenuItem("Settings", new EventHandler(OnOpen)));
ctxMenu.MenuItems.Add( new MenuItem("-");
ctxMenu.MenuItems.Add( new MenuItem("Exit", new EventHandler(OnExit)));
}
Then the only thing left is to trap the users exit. I've done the same as MSN messenger and removed the minimize and maximize buttons, and then trapped the on_exit event. I did this by adding
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
And then one of the event handlers for the context menu reverses this process. I think that should be enough to get you going. Let me know if you need anything else, or if anybody out there has any suggestions on how to do this better as I'm still pretty new to it =)
hi , I was looking for a way to minimaze to sys tray .... and I am glad that I've found your post. Well to , to be honest at first reading I didn't understud much from you post but I've saved it and tomorow I am going to try it .
I have a question : how can I trace key presses( as if my application had focus ) even if my application is in sys tray ? Is this possible?
Any link to a tutorial about minimize to sys tray and related would pe apreciated. Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.