title: Detect if Windows closing or application tries to close from system menu (WM_CLOSE)
body: <p>I'm having Tray application.</p>
  
  <p>Onj FormCloseQuery I check if program should goto tray and instead of closing it I put it in tray (CanClose := False)</p>
  
  <p>But if Windows tries to close my application because of Windows shutdown I want not to move my app into tray but to close it.</p>
  
  <p>Win7 terminates my app, but XP doesn't close because my app remains in Tray.</p>
  
  <p>How can I detect if Windows is some "shutting down" mode or not?</p>
  
  <p>Thanks!</p>