title: handling Quit event from Word in Delphi
body: <p>how can i handle the event Quit from Word in Delphi code?</p>
  
  <p>i would like to do the same like <a href="https://stackoverflow.com/questions/11041494/execution-freezing-while-checking-if-word-is-visible">this</a>, but in delphi</p>
  
  <p>i've got the same problem of the linked post</p>
  
  <p>my code is like :</p>
  
  <pre><code>type
  TMSOAWinWord97 = class(...)
      private
          FApplication : OleVariant;
      protected
          procedure WordAppQuit(Sender: TObject);
      public
          ...
  end;
  
  procedure TMSOAWinWord97.WordAppQuit(Sender: TObject);
  begin
      FApplication := unassigned;
  end;
  
  procedure TMSOAWinWord97.CreateApplication(showApplication: Boolean);
  begin   
      FApplication:=CreateOleObject('Word.Application.12');
      FApplication.Quit := WordAppQuit;
      ...
  end;
  </code></pre>