title: SendMessage to Edit controI C++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9984770/using-sendmessage-to-enter-text-into-an-edit-control-belonging-to-another-proces">Using SendMessage to enter text into an edit control belonging to another process</a>  </p>
  </blockquote>
  
  
  
  <p>I want to set up text in edit control of directx window programatically. I can get correct handle of edit control, but text is inserted only if I click on Edit control, How can insert text without clicking on Edit control. I'm doing this:</p>
  
  <pre><code>HWND hWnd = FindWindow(NULL,"Game");
  HWND edit = FindWindowEx(hWnd, NULL, "Edit", NULL);
  
  SendMessage(edit, WM_CHAR, (TCHAR) 'H', 0);
  Sleep(100);
  SendMessage(edit, WM_CHAR, (TCHAR) 'E', 0);
  Sleep(100);
  SendMessage(edit, WM_CHAR, (TCHAR) 'L', 0);
  Sleep(100);
  SendMessage(edit, WM_CHAR, (TCHAR) 'L', 0);
  Sleep(100);
  SendMessage(edit, WM_CHAR, (TCHAR) 'O', 0);
  Sleep(100);
  </code></pre>
  
  <p>Parent window hides/disables the edit control when I move away from edit control.</p>
  
  <p>this code is working only if I click Edit control at same time when code running.... but how to make it programatically and full automated to insert text without clicking on Edit control. It is possible to do this all in background?</p>