title: C# Sending CTRL+C keyboard input to Word
body: <p>I'm currently practicing hotkeys and writing a small background app that instantly googles the selected text on the ctrl+shift+alt+N hotkey.</p>
  
  <p>It all works very well. I register the global HK, I intercept the message via WndProc() etc.</p>
  
  <p>What does not work is the way I'm trying to copy the selected text in the currently focused window by sending it a CTRL+C keyboard input.</p>
  
  <p>Here is my current method, in a nutshell:</p>
  
  <pre><code>IntPtr fWin = GetForegroundWindow();
  SetForegroundWindow(fWin);
  
  //InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_C);
  SendKeys.SendWait("^(c)"); //I tried both ways, with the InputSimulator lib, and the standard SendKeys. None work.
  
  Thread.Sleep(1000); //I wait a little bit for the clipboard to get the text.
  
  Console.WriteLine(Clipboard.GetText()); //This is where I get disappointed...
  
  Process.Start("firefox.exe", "-new-tab http://www.google.com/search?q=" + Clipboard.GetText().Replace(" ", "%20"));
  </code></pre>
  
  <p>This method works for some applications only (like the one we use in the office: Trados Studio which is quite the complex text management software). However, I'm <strong>unable to make it work with applications like Word, Outlook or Notepad</strong>.</p>
  
  <p>Believe it or not, I'm able to send them letters like this:</p>
  
  <pre><code>string txt = "Y U NO WORK?";
  SendWait(txt);
  //OR
  InputSimulator.SimulateTextEntry(txt);
  </code></pre>
  
  <p>But when it comes up to CTRL+C, <strong>nothing happens</strong>.</p>
  
  <p>Do you guys have an idea of what's going on? I hope there isn't some MS restrictions on this one... Thanks in advance!</p>