title: Coded UI: HRESULT E_FAIL has been returned from a call to a COM component
body: <p>I'm trying to create test that runs my application and enter text in the field using CodedUI.This is my code:</p>
  
  <pre><code> var app = ApplicationUnderTest.Launch(@"C:\app.exe");
   var loginEdit = new WinEdit();
   loginEdit.SearchProperties.Add(WinEdit.PropertyNames.ControlName, "textEditLogin");
   loginEdit.Text = "test005";
  </code></pre>
  
  <p>Error: <code>System.NotSupportedException: SetProperty "Text" is not supported on control type: Window.</code></p>
  
  <p>If i use this code:</p>
  
  <pre><code>Keyboard.SendKeys(loginEdit, "test005");
  </code></pre>
  
  <p>I have error: <code>Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException: (Failed to get the message for an exception of type Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException due to an exception.) ---&gt; System.Runtime.InteropServices.COMException: HRESULT E_FAIL has been returned from a call to a COM component</code></p>
  
  <p>This is properties of my WinEdit:
  <a href="https://i.stack.imgur.com/j7tZO.png" rel="nofollow noreferrer">WinEdit</a></p>
  
  <p>What could be the problem?</p>