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 1 2151
Please review, http://www.dotnet247.com/247referenc.../14/74770.aspx
OnSessionEnding( does not work, there is some problem ??
Regards
"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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 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...
|
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 and static, this this does'nt seem
to help.
Could someone plesase help? My code is below:
|
by: Paul Steele |
last post by:
Some time ago I tracked down the code for detecting the shutdown event
within a C# program. I tested it, it worked, and I moved on. However, I just
discovered that the code is no longer working, and I'm baffled. I've done
some more Google searches and have come up with the same thing. A portion of
the code is below. I call the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| | |