473,322 Members | 1,480 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,322 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 2009
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Manfred Braun | last post by:
Hi All, I am trying to fetch system-events, and I am successful with "TimeChanged", but cannot get "SessionEnding". I am not an OO expert and so - just to be sure - I made all my methods public...
0
by: Manfred Braun | last post by:
Hi All, I am trying to fetch system-events, and I am successful with "TimeChanged", but cannot get "SessionEnding". I am not an OO expert and so - just to be sure - I made all my methods public...
1
by: Waqar | last post by:
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...
1
by: Waqar | last post by:
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.