471,336 Members | 1,239 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

OnSessionEnding(object sender, SessionEndingEventArgs e) fasiles

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
Jul 21 '05 #1
1 1914
please review following link,
http://www.dotnet247.com/247referenc.../14/74770.aspx

have the same discussion , but OnSessionEnding( event is not fired. There
is some problem???

Any sugestion ??

.....
"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

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Manfred Braun | last post: by
reply views Thread by Manfred Braun | last post: by
reply views Thread by rosydwin | last post: by

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.