title: Mac OSX: How to detect that NO window is selected?
body: <p>I am working on the app which resizes the selected window. 
  It works successfully when any window is selected. But crashes when no window is selected.</p>
  
  <p>Currently fetching front most window from the following code.</p>
  
  <pre><code>AXUIElementCopyAttributeValue(frontMostApp, kAXFocusedWindowAttribute, (CFTypeRef *)&amp;frontMostWindow);
  </code></pre>
  
  <p>But how to detect that control is on desktop or all the windows are inactive.</p>