Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Closing MFC application with OnQueryEndSession

$
0
0

Hi,

I'm currently working on a Windows application that automatically run at startup. It's a fullscreen application (MFC app developed in C++ with VS2005) and the only way to shut it down is to press the power button of the computer.

So as to free storage and do some necessary operations before closing application, I intercept the Windows Message thank to OnQueryEndSession().

However one of the last operation consists in saving a number of pictures remaining in a buffer.

This operation is quite long and before the end of the application, Windows opens a "End Program" window saying that the program is not responding. I know this appends because OnQueryEndSession does not return enough fastly but I need to save these images before closing.

Then I'd like to know a way to prevent this message or to hide it. Is it possible ?

I tried to create a Closing Thread in OnQueryEndSession (just before returning zero) to do all necessary stuff but it didn't work. An error window appears when OnQueryEndSession returns.

Your help is welcome :)

Thank you in advance

Lucas


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>