title: UI Automation in UWP application for detecting controls in another application
body: <p>I want to access control elements of an application using UI Automation framework. The current codebase is built is a UWP application and I want to extend this feature on it. I wrote a c++ script using UIAutomation to extract control elements. However, the same code run in UWP app gives different result that that of a console c++ application. There is something stopping the UWP application from accessing ui elements. Is there some way in which UI Automation framework can be used in UWP?</p>
  <p>The following is a part of the code that abstracts the number of elements inside a foreground running application. This code gives very few control elements ( less than 5) when run from a UWP. The same script gives around 30 - 600 elements when run from console application.</p>
  <pre><code>    HWND foreground = GetForegroundWindow();
      IUIAutomationElement* temp;
      uia-&gt;aut-&gt;ElementFromHandle(foreground, &amp;temp);
      wcout &lt;&lt; uia-&gt;name(temp) &lt;&lt; endl;
      IUIAutomationTreeWalker* walker;
      uia-&gt;aut-&gt;get_RawViewWalker(&amp;walker);
  
      IUIAutomationElementArray* arr;
      IUIAutomationCondition* condition;
      uia-&gt;aut-&gt;CreateTrueCondition(&amp;condition);
      temp-&gt;FindAll(TreeScope_Subtree, condition, &amp;arr);
      int sz; arr-&gt;get_Length(&amp;sz);
      cout &lt;&lt; sz &lt;&lt; endl;
  </code></pre>