title: How to send an "ENTER" key press to another application?
body: <p>I have code that launches an external application and automatically fills in a password prompt.</p>
  
  <p>I want to automate the pressing of the "ENTER" key, so that the user does not have to click "OK".</p>
  
  <p>How can I send the ENTER key to an external application?</p>
  
  <p>Below is my code as it stands right now.</p>
  
  <p>The first line to post the password to the application works fine.</p>
  
  <p>The second line to send an ENTER key press has no effect at all.</p>
  
  <p>I am using Delphi 2010.</p>
  
  <pre><code>    //now that we have the control handle, send the password to it
      SendMessage(AppHandle,WM_SETTEXT,0,Integer(PChar(pwd)));
  
      //and now push ENTER
      SendMessage(AppHandle,WM_KEYDOWN,0,Integer(PChar(#13)));
  </code></pre>