# systemRequestedQuit

**URL:** <https://forum.juce.com/t/systemrequestedquit/8224>\
**Category:** General JUCE discussion\
**Created:** [February 27, 2012, 6:34pm UTC](https://forum.juce.com/t/systemrequestedquit/8224 "2012-02-27T18:34:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xavi](https://avatars.discourse-cdn.com/v4/letter/x/8e8cbc/32.png) [@Xavi](https://forum.juce.com/u/Xavi)\
**Post date:** [February 27, 2012, 6:34pm UTC](https://forum.juce.com/t/systemrequestedquit/8224/1 "2012-02-27T18:34:30Z")

</div>

Hi,

Is there any way in Juce to know when systemRequestedQuit() is called directly by the OS? For example, when the user shutdown the computer while the app is running.  
It’d be very useful to know it.

Maybe something like this?:

code  
void systemRequestedQuit(bool os\_closing=false);  
(…)

(…)  
case WM\_QUERYENDSESSION:  
if (JUCEApplication::getInstance() != nullptr)  
{  
JUCEApplication::getInstance()-\>systemRequestedQuit(true);  
return MessageManager::getInstance()-\>hasStopMessageBeenSent();  
}  
return TRUE;  
(…) [/code]
