title: Use SendMessage in C# to perform a CTRL-C operation on a given handle
body: <p>In Google Chrome you can retrieve the text of a JavaScript alert/dialog by simply having the dialog open and doing CTRL-C on the dialog. This will put the text in the dialog into the clipboard.</p>
  
  <p>I'm trying to use <a href="http://msdn.microsoft.com/en-us/library/ms644950%28VS.85%29.aspx" rel="nofollow noreferrer">SendMessage</a> to send CTRL-C to perform a copy on the text of a JavaScript dialog. I've already managed to do this using SendInput but unfortunately that could fail if the window doesn't have focus.</p>
  
  <p>I have tried using SendMessage with WM_COPY message but that didn't work for my needs.</p>
  
  <p>Please if anyone has done this before successfully using SendMessage I would greatly appreciate your help.</p>