title: Win32: Get message notification of other application's close/exit
body: <p>My application needs to monitor all other running applications on the system. Is there some way I could get notified on exit of every application exe?</p>
  
  <p>The methods I could find:</p>
  
  <p>1) Use PSAPI functions to get the list of running exes at frequent intervals. At each poll compare with the previous list to find which application/process has exited.
  Disadvantage: Requires constant polling, will take CPU time.</p>
  
  <p>2) Set a global hook for WM_CLOSE message: Using this I would be able to get a notification when any application gets closed through the close button on the title bar</p>
  
  <p>Disadvantage:
  (-)Not all the applications are generating a WM_CLOSE message(Ex: Total Video Player Exe)
  (-)If the application was closed through the "Exit" menu or button (e.g. File->Exit) , I can't trap that message</p>
  
  <p>Is there any other better way that I missed? Please advise.</p>