Not able to create instance for InputStimulator to handle Mouse Move

Mar 14, 2014 at 12:46 PM
As per the source code given, have tried the below code,

var mov = new InputSimulator();

but i am getting the below two error's. Please assist.

Error 1 Cannot declare a variable of static type 'WindowsInput.InputSimulator'
Error 2 Cannot create an instance of the static class 'WindowsInput.InputSimulator'
Mar 16, 2014 at 3:34 PM
Edited Mar 16, 2014 at 3:41 PM
For the new version, you need to get it from NuGet, or download the source code and compile it. The download (version 0.1.0.0) is obsolete.

Or you use the static functions of the old version such as
InputSimulator.SimulateWhatEver(...)
Coordinator
Mar 17, 2014 at 12:12 AM
Hi, yes I need to update the code examples on the home page. Best bet is to download/clone the source for the latest version and take a look at the tests - they give a good example of how to use it.

Mike


Mar 17, 2014 at 10:07 AM
michaelnoonan wrote:
Hi, yes I need to update the code examples on the home page. Best bet is to download/clone the source for the latest version and take a look at the tests - they give a good example of how to use it. Mike
Hi Mike,

It would be great if you can share to me with code examples for mouse event stimulation alone.

Thanks,
Selvendran P.
Coordinator
Mar 17, 2014 at 10:21 AM
https://github.com/michaelnoonan/inputsimulator/blob/master/WindowsInput.Tests/InputSimulatorExamples.cs

public void TestMouseMoveTo()
{
var sim = new InputSimulator();
sim.Mouse
.MoveMouseTo(0, 0)
.Sleep(1000)
.MoveMouseTo(65535, 65535)
.Sleep(1000)
.MoveMouseTo(65535/2, 65535/2);
}

Hope that helps.
Mike


Mar 17, 2014 at 11:31 AM
Hi Mike,

Thanks, now it is working fine after removing the reference "inputstimulator.dll" and adding the reference "WindowsInput.dll"

Also, it is not stimulating function keys to the Citrix applications like (Tab, Enter, F7 etc.,)

Is there any possible ways to send the function keys to the Citrix application?

Thanks,
Selvendran P.
Coordinator
Mar 18, 2014 at 12:04 AM
Hi Selvendran,

I'm sorry, that's over to you. I know there'll be issues related to UAC in certain circumstances, and others have had issues getting input to DirectX etc (which makes sense) - sadly it will generally fail silently too.

Good luck with your project.
Mike