Opt("TrayAutoPause",0) Global Const $user32dll = DllOpen("user32.dll") GUIRegisterMsg(0x00FF,WM_INPUT) Local $dev = DllStructCreate('struct;ushort UsagePage;ushort Usage;dword Flags;hwnd hTarget;endstruct') $dev.UsagePage = 0x01 $dev.Usage = 0x02 $dev.Flags = 0x00000100 $dev.hTarget = GUICreate("") DllCall($user32dll, 'bool', 'RegisterRawInputDevices', 'struct*', $dev, 'uint', 1, 'uint', DllStructGetSize($dev)) Do Until GUIGetMsg()=-3 Func WM_INPUT($hWnd,$Msg,$wParam,$lParam) Local Static $HEADER ='struct;dword Type;dword Size;handle hDevice;wparam wParam;endstruct;' Local Static $TAG = $HEADER & 'ushort flag;ushort Alignment;ushort bflg;short bdta;ulong rbtn;long dx;long dy;ulong info;' Local Static $HEADSIZE = DllStructGetSize(DllStructCreate($HEADER)) Local Static $TAGSIZE = DllStructGetSize(DllStructCreate($TAG)) Local Static $locked = False Local $input = DllStructCreate($TAG) DllCall($user32dll, 'uint','GetRawInputData', 'handle', $lParam, 'uint', 0x10000003, 'struct*', $input, 'uint*', $TAGSIZE, 'uint', $HEADSIZE ) With $input If .bflg Then If BitAnd(16,.bflg) Then Local $aCall = DllCall($user32dll,"dword","GetMessagePos") Local $x=BitAnd(0xffff,$aCall[0]),$y=BitShift($aCall[0],16) Local $clip = DllStructCreate("struct;long left;long top;long right;long bottom;endstruct") $clip.left = $x $clip.top = $y $clip.right = $x+1 $clip.bottom = $y+1 DllCall( $user32dll, "bool", "ClipCursor", "struct*", $clip ) $locked = True Endif If BitAnd(32,.bflg) Then DllCall( $user32dll, "bool", "ClipCursor", "struct*", Null ) $locked = False Endif ElseIf $locked Then ScrollMouseXY(.dx,-.dy,$user32dll) EndIf EndWith Return 0 EndFunc Func ScrollMouseXY($dx,$dy,$dll='user32.dll') Local Static $size = DllStructGetSize(DllStructCreate("dword type;struct;long dx;long dy;dword mouseData;dword dwFlags;dword time;ulong_ptr dwExtraInfo;endstruct;")) Local Static $arr = DllStructCreate("dword type1;struct;long dx1;long dy1;dword mouseData1;dword dwFlags1;dword time1;ulong_ptr dwExtraInfo1;endstruct;" & _ "dword type2;struct;long dx2;long dy2;dword mouseData2;dword dwFlags2;dword time2;ulong_ptr dwExtraInfo2;endstruct;" ) $arr.dwFlags1=0x1000 $arr.mouseData1=$dx $arr.dwFlags2=0x0800 $arr.mouseData2=$dy DllCall($dll,"uint","SendInput","uint",2,"struct*",DllStructGetPtr($arr),"int",$size) EndFunc