|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
OnSessionEnding(object sender, SessionEndingEventArgs e) failsI have a windows form that when it closes it simply hides itself in combination for a notify icon to reactivate it again - like Microsoft messenger. You have to specifically exit the application by right clicking on the NotifyIcon and selecting Exit from it's context menu. I'm overriding the OnClosing event, hiding the form, and setting the CancelEventArgs.Cancel to true so that the app is not closed but instead remains alive on the system tray (NotifyIcon). But this causes a problem when you shutdown Windows, the OnClosing is overridden by my code since I can tell the difference between the user pressing the X to close the window or Windows closing it for a system shutdown. So when this application is running, the system will not shut down until you manually close this application - which I don't need to tell you how frustrating that is to users. Some body will sure suggest me to use public void OnSessionEnding(object sender, SessionEndingEventArgs e) to control the shutdownevent and close the window in that. But this event is not working properly. Can any body can give me some lights over this issuse. what i need is a code sample or references to matterial about it. Looking for a working sample if possible. Thanks. Regards, Waqar Pleasze review
http://www.dotnet247.com/247reference/msgs/14/74770.aspx Same dission, but OnSessionEnding( fails to notify about shutdown. Regards, Afaq Show quoteHide quote "Waqar" wrote: > hi, > > I have a windows form that when it closes it simply hides itself in > combination for a notify icon to reactivate it again - like Microsoft > messenger. You have to specifically exit the application by right clicking > on the NotifyIcon and selecting Exit from it's context menu. > > I'm overriding the OnClosing event, hiding the form, and setting the > CancelEventArgs.Cancel to true so that the app is not closed but instead > remains alive on the system tray (NotifyIcon). But this causes a problem > when you shutdown Windows, the OnClosing is overridden by my code since I > can tell the difference between the user pressing the X to close the window > or Windows closing it for a system shutdown. So when this application is > running, the system will not shut down until you manually close this > application - which I don't need to tell you how frustrating that is to > users. > > Some body will sure suggest me to use > > public void OnSessionEnding(object sender, SessionEndingEventArgs e) > > to control the shutdownevent and close the window in that. > > But this event is not working properly. Can any body can give me some lights > over this issuse. > > what i need is a code sample or references to matterial about it. > > Looking for a working sample if possible. > > Thanks. > > Regards, > Waqar > >
Other interesting topics
System.Reflection
How to dynamically load strong name assemblies Events & Delegates Strong Typing of Primitive Types crystal report export function streamreader halt Process.Start - The requested lookup key was not found in any active activation context. simple confirmation on XML comments ... Checking whether "SomeString" is Directory or File... Any hints on how to use the MvpSerializerFormatter with EntLib? |
|||||||||||||||||||||||