title: How to test for PowerPoint SlideShowWindow object?
body: <p>I am automating PowerPoint 2010 using VSTO and I want to check if the SlideShowWindow is available before calling methods on it.</p>
  
  <p>At the moment I am catching the <em>COMException</em> returned when accessing;</p>
  
  <pre><code>Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow
  </code></pre>
  
  <p>The full method is;</p>
  
  <pre><code>private SlideShowWindow GetSlideShowWindow()
  {
      //attempt to get the running slide show window...
      SlideShowWindow slideShowWindow = null;
      try
      {
          //try to access the COM wrapper...
          slideShowWindow = Globals.ThisAddIn.Application.ActivePresentation.SlideShowWindow;
      }
      catch (COMException)
      {
          //window doesn't exist!...
      }
  
      //return window or null...
      return slideShowWindow;
  }
  </code></pre>
  
  <p>It seems like there should be an enum or flag somewhere in the object model that would avoid this approach?</p>