title: Click on button using UI Automation in Winform application in VC++
body: <p>I want to click on a button using UI Automation. I am using UI Automation in Winform VC++.</p>
  
  <p>Here is my code..</p>
  
  <pre><code> AutomationElement^  Select_connect_button= aeForm-&gt;FindFirst(TreeScope::Children,gcnew PropertyCondition(AutomationElement::NameProperty, "Select/Connect"));
  InvokePattern^ ipClickButton1 = (InvokePattern)Select_connect_button-&gt;GetCurrentPattern(InvokePattern::Pattern);
   ipClickButton1-&gt;Invoke();
  </code></pre>
  
  <p>but it is showing these Error:</p>
  
  <pre><code>error C2440: 'type cast' : cannot convert from 'System::Object ^' to 'System::Windows::Automation::InvokePattern'
  
  error C2440: 'initializing' : cannot convert from 'System::Windows::Automation::InvokePattern' to 'System::Windows::Automation::InvokePattern ^'
  </code></pre>
  
  <p>Can anybody please help me to resolve these Errors.</p>
  
  <p>Thanks.</p>