POC: RawInput mouse via C# CLR

Talk about things C#, some related to AutoHotkey
Posts: 16
Joined: 11 Jun 2017, 09:52

Re: POC: RawInput mouse via C# CLR

Post by Galvatron » 20 Jul 2017, 12:22

Okay, made it to work. These values seem to be fine and more precise than with mousedelta:
MoveEvent(x, y, mouseId){
x := round(x / 2)
y := round(y / 2)
Global mdw
if (mdw.SelectedMouse == 0 || mdw.SelectedMouse == mouseId){
DllCall("mouse_event",uint,1,int, x ,int, y,uint,0,int,0)
But using "x / 3" or lower doesn't seem to work properly.

Re: POC: RawInput mouse via C# CLR

Post by Avc001 » 30 Jul 2018, 23:34

Bro please help me... Can you do this for me???

Mouse move left = left arrow key , when stop moving = arrow key left up
Mouse move right = right arrow key , when stop moving = arrow key right up

put a deadzone on the x-axis as well is possible

and make sure the the mouse is infinite like its doesnt hit the edge and stops. Its lke in a real fps game you know. Please help

email me asap when you got it:
[email protected]

I want to use delta rawinput api of mouse on this code here:::
CoordMode, Mouse, Screen

deadzone := 6
deadzoneX := Floor(deadzone*1.2)

settimer, watchMouse, 10

cnt++, pCnt:=cnt-1
mouseGetPos, mx%cnt%
send % ( mx%cnt%>mx%pCnt%+deadzoneX ? "{right}" : mx%cnt%<mx%pCnt%-deadzoneX ? "{left}" : "" )

esc::exitApp ; <-- press esc to exit
Posts: 13
Joined: 10 Mar 2019, 19:25

Re: POC: RawInput mouse via C# CLR

Post by Trej » 21 Mar 2019, 08:48

Hi @evilC,

Is there anyway to modify this to receive messages from the surface dial?

I have no idea where to start in implementing this in AHK.
User avatar
Posts: 4791
Joined: 27 Feb 2014, 12:30

Re: POC: RawInput mouse via C# CLR

Post by evilC » 21 Mar 2019, 09:03

I don't know much about the Surface Dial, but the short answer is No - this will not *natively* support the dial.
What I mean by this is that the dial will likely be a HID device natively, sending dial-specific signals to the PC.
In order to support it natively, you could possibly use AHKHID.

However, it seems that in some modes, the dial sends normal mouse or keyboard signals, which this library *could* read, however that is not likely to be of much use, because...
If the dial sends, for example, wheel up or wheel down, RawInput *could* see it, but could *not* remap it (Make it do something else).

In that instance, you could use AHI (See link in signature) to subscribe to the wheel signals coming from the dial (And only the dial, it would not respond to your normal mouse wheel) and allow you to remap them
Post Reply

Return to “C#”