jasonpang / Interceptor

C# wrapper for a Windows keyboard driver. Can simulate keystrokes and mouse clicks in protected areas like the Windows logon screen (and yes, even in games). Wrapping http://oblita.com/Interception
MIT License
286 stars 84 forks source link

Mouse clicks doesn't work on Windows 10 #10

Open barak1413 opened 6 years ago

barak1413 commented 6 years ago

I tried to change the MouseState enum values with no success.

By the way, thanks for great project!

SaveTheHuman5 commented 6 years ago

Hello Barak i see you fix the problem checking stackoverflow. https://stackoverflow.com/questions/47151718/simulate-mouse-clicks-in-kernel-space I think you make reference to mouse id InterceptionDriver.Send(context, 12

Please can explain how you do? What number should be instead 12?

Really apreciated some help

liq19ch commented 4 years ago

Hi,

To get the mouse id:

  1. Set both keyboard filter and mouse filter when initialising the input object.

        input = new Input();
        input.KeyboardFilterMode = KeyboardFilterMode.All;
        input.MouseFilterMode = MouseFilterMode.All;
        bool isLoad = input.Load();

  2. Add a global variable mouseId in Intercepter.Input.cs

    • private int mouseId;

  3. Get the mouse id in DriverCallback function (Also in Intercepter.Input.cs)

    private void DriverCallback()
    {
    ....
    if (InterceptionDriver.IsMouse(deviceId) > 0)
            {
    • mouseId = deviceId;

              if (OnMousePressed != null)
              {

      ....

  4. Change the mouse from 12 to mouseId in the following functions

    SendMouseEvent

MoveMouseBy

MoveMouseTo


Remember to the bool useDriver from false to true.

barak1412 commented 4 years ago

On my platform the correct mouse device is 11.

taejun13 commented 4 years ago

Thank you. saved my life. mine was also 11.

Jamisco commented 3 years ago

Yup, correct device is 11

For anyone not being able to send mouse clicks, try going into the Inteceptor.SendMouseEvent method

and in the line
InterceptionDriver.Send(context, 12, ref stroke, 1);

change the 12 to 11, so now the line looks like this

        InterceptionDriver.Send(context, 11, ref stroke, 1);