title: Why does SendInput Ctrl+V not work in Outlook?
body: <p>I have a program that uses system wide hotkeys <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>a key of the user's choice</kbd> to paste the text in the clipboard by sending the <kbd>Ctrl</kbd>+<kbd>V</kbd> combination using SendInput as used <a href="https://stackoverflow.com/questions/18662637/sendinput-vs-keybd-event">here</a>. This works fine in most programs. But in Outlook on the To field of a new email, every key I try ends up bringing up the "Move Item To Folder" Outlook dialog box which is supposed to be the <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>V</kbd> key combination. In the Body field nothing happens. Any ideas what is happening here? See code to reproduce below:</p>
  
  <pre><code>procedure TForm1.FormCreate(Sender: TObject);
  begin
    If not RegisterHotkey( Handle, 1, MOD_SHIFT or  MOD_CONTROL, Ord('P') ) Then
      ShowMessage('Error');
  end;
  
  Procedure TForm1.WMHotkey( Var msg: TWMHotkey );
  var
    KeyInputs: array of TInput;
  
    procedure KeybdInput(VKey: Byte; Flags: DWORD);
    begin
      SetLength(KeyInputs, Length(KeyInputs)+1);
      KeyInputs[high(KeyInputs)].Itype := INPUT_KEYBOARD;
      with  KeyInputs[high(KeyInputs)].ki do
      begin
        wVk := VKey;
        wScan := MapVirtualKey(wVk, 0);
        dwFlags := Flags;
      end;
    end;
  
  Begin
    If (msg.HotKey &gt; 0) And (msg.HotKey &lt; 2) Then
    Begin
      Clipboard.AsText:= 'Some text';
      KeybdInput(VK_CONTROL, 0);                // Ctrl
      KeybdInput(Ord('V'), 0);
      KeybdInput(Ord('V'), KEYEVENTF_KEYUP);
      KeybdInput(VK_CONTROL, KEYEVENTF_KEYUP); // Ctrl
      SendInput(Length(KeyInputs), KeyInputs[0], SizeOf(KeyInputs[0]));
    end
  End;
  </code></pre>