mirror of
https://github.com/evilC/AutoHotInterception.git
synced 2024-11-15 00:12:50 +00:00
Update test apps
This commit is contained in:
parent
f072c3bb57
commit
281f7fe786
26
C#/TestApp/KeyboardTester.cs
Normal file
26
C#/TestApp/KeyboardTester.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AutoHotInterception;
|
||||
|
||||
namespace TestApp
|
||||
{
|
||||
public class KeyboardTester
|
||||
{
|
||||
public KeyboardTester()
|
||||
{
|
||||
var im = new Manager();
|
||||
|
||||
var devId = im.GetKeyboardId(0x04F2, 0x0112);
|
||||
|
||||
if (devId == 0) return;
|
||||
|
||||
im.SubscribeKey(devId, 0x2, false, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine($"State: {value}");
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
48
C#/TestApp/MouseTester.cs
Normal file
48
C#/TestApp/MouseTester.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AutoHotInterception;
|
||||
|
||||
namespace TestApp
|
||||
{
|
||||
public class MouseTester
|
||||
{
|
||||
public MouseTester()
|
||||
{
|
||||
var im = new Manager();
|
||||
|
||||
var mouseHandle = "HID\\VID_046D&PID_C52B&REV_2407&MI_02&Qid_1028&WI_01&Class_00000004";
|
||||
var devId = im.GetMouseIdFromHandle(mouseHandle);
|
||||
|
||||
var counter = 0;
|
||||
|
||||
if (devId != 0)
|
||||
{
|
||||
im.SubscribeMouseButton(devId, 1, true, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine("RButton Button Value: " + value);
|
||||
}));
|
||||
im.SubscribeMouseButton(devId, 3, true, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine("XButton1 Button Value: " + value);
|
||||
}));
|
||||
im.SubscribeMouseButton(devId, 4, true, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine("XButton2 Button Value: " + value);
|
||||
}));
|
||||
im.SubscribeMouseButton(devId, 5, true, new Action<int>(value =>
|
||||
{
|
||||
Console.Write("WheelVertical Value: " + value);
|
||||
var mycounter = counter;
|
||||
mycounter++;
|
||||
Console.WriteLine(" Counter: " + mycounter);
|
||||
counter = mycounter;
|
||||
}));
|
||||
}
|
||||
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
@ -7,38 +7,8 @@ namespace TestApp
|
||||
{
|
||||
private static void Main()
|
||||
{
|
||||
var im = new Manager();
|
||||
|
||||
var mouseHandle = "HID\\VID_046D&PID_C52B&REV_2407&MI_02&Qid_1028&WI_01&Class_00000004";
|
||||
var mouseId = im.GetMouseIdFromHandle(mouseHandle);
|
||||
|
||||
var counter = 0;
|
||||
|
||||
if (mouseId != 0)
|
||||
{
|
||||
im.SubscribeMouseButton(mouseId, 1, true, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine("RButton Button Value: " + value);
|
||||
}));
|
||||
im.SubscribeMouseButton(mouseId, 3, true, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine("XButton1 Button Value: " + value);
|
||||
}));
|
||||
im.SubscribeMouseButton(mouseId, 4, true, new Action<int>(value =>
|
||||
{
|
||||
Console.WriteLine("XButton2 Button Value: " + value);
|
||||
}));
|
||||
im.SubscribeMouseButton(mouseId, 5, true, new Action<int>(value =>
|
||||
{
|
||||
Console.Write("WheelVertical Value: " + value);
|
||||
var mycounter = counter;
|
||||
mycounter++;
|
||||
Console.WriteLine(" Counter: " + mycounter);
|
||||
counter = mycounter;
|
||||
}));
|
||||
}
|
||||
|
||||
Console.ReadLine();
|
||||
//var mt = new MouseTester();
|
||||
var kt = new KeyboardTester();
|
||||
}
|
||||
}
|
||||
}
|
@ -42,6 +42,8 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="KeyboardTester.cs" />
|
||||
<Compile Include="MouseTester.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user