Type or namespace 'InputSimulator' could not be found

Feb 4, 2015 at 5:19 PM
I have a simple form with a button, when the button is clicked a message is displayed. I'm using the Keyboard.KeyPress(VirtualKeyCode.RETURN) to simulate a user clicking the button. I getting the "Type or namespace 'InputSimulator' could not be found" message and I have the InputSimulator.dll added. Not sure what's going on. Code is below, thanks.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsInput.Native;



namespace TestButton
{
public partial class frmTest : Form
{
    public frmTest()
    {
        InitializeComponent();
    }

    //public void PressReturn()
    //{
    //    InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
    //}

    private void btnTestButton_Click(object sender, EventArgs e)
    {
        btnTestButton.Enabled = true;
        InputSimulator s = new InputSimulator();
        s.Keyboard.KeyPress(VirtualKeyCode.RETURN);

        System.Windows.Forms.MessageBox.Show("Test Button was clicked");

    }

}
}
May 1, 2015 at 9:05 PM
add the following line at the top of the code:
using WindowsInput;