Avoiding System Close

G

Guest

Hi
I have a C# application I want to run both in the foreground , and if
possible in the background.
My application gives visual and audio feedback to the user while in the
foreground, and hopefully audio only when in the background.

However I am having a bit of a problem avoiding being closed by the system.
I understand that the system should be able to close applications in the
background if resources are running low but what I am observing is that I
always get shut down.
If I switch to the Microsoft-Tasks application, my application is closed
down.

I have implemented my application so that when it receives the _Deactivate
event it releases all UI components to try and improve my chances of staying
alive, however I still get the
_Closed event straight after the _Deactivate event.

I am a bit lost on how to proceed, and would value any suggestions on how to
do this.

thanks in advance
Guus Davidson
 
G

Guest

I don't know about you, but whatever you put in OnClosing event - to prevent
your app from closing it either; closes or gets very unstable.

What I have done to get around an end-user shutting down my app from Task
Manager is to simply set the Text property to blank "" on a OnDeactivate
event. Doing this will ensure your application doesn't show up in the list of
running applications so it can't be shutdown.

Likewise, set the Text property back on a OnActivated event.
 
D

Daniel Moth

In addition to other responses, handle the static MobileDevice.Hibernate
event and clean up in there (i.e. release any unnecessary resources).

Cheers
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top