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
296 stars 85 forks source link

Win 10 Compatability #4

Open cuken opened 8 years ago

cuken commented 8 years ago

Any chance this can get an update for win10 compatibility? The referenced library is win10 compat,

theblixguy commented 8 years ago

I have the same question. The driver supports Windows 10, so why doesn't this library do?

mosvath commented 8 years ago

Actually it works with Windows 10 (games included).

`public partial class Form1 : Form { [DllImport("User32.dll")] static extern int SetForegroundWindow(IntPtr point);

    public Form1()
    {
        InitializeComponent();
    }
    private void button1_Click(object sender, EventArgs e)
    {
        Input input = new Input();
        input.KeyPressDelay = 0;
        input.KeyboardFilterMode = KeyboardFilterMode.All;
        if (!input.Load())
        {
            MessageBox.Show("Interceptor driver cannot be loaded!");
        }
        else
        {
            MessageBox.Show("Press enter!");
            Process p = Process.GetProcessesByName("Fallout4").FirstOrDefault();
            if (p != null)
            {
                SetForegroundWindow(p.MainWindowHandle);
                if (input.IsLoaded)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        input.SendKey(Interceptor.Keys.S, KeyState.Down);
                        Thread.Sleep(50);
                        input.SendKey(Interceptor.Keys.S, KeyState.Up);
                        Thread.Sleep(50);
                    }
                    Thread.Sleep(1000);
                    for (int i = 0; i < 5; i++)
                    {
                        input.SendKey(Interceptor.Keys.W, KeyState.Down);
                        Thread.Sleep(50);
                        input.SendKey(Interceptor.Keys.W, KeyState.Up);
                        Thread.Sleep(50);
                    }
                }
            }
        }
        input.Unload();
    }
}`

If you want to use special characters, like Cursor Up or Cursor Down use the following SendKey: input.SendKey(Interceptor.Keys.Down, KeyState.E0); Thread.Sleep(50); input.SendKey(Interceptor.Keys.Down, KeyState.E1); Thread.Sleep(50);

baaron4 commented 6 years ago

How did you use the builder for win10 x64? buildit-x64.cmd only seems to have options for win7 and older

huh uhu