阅读:1617回复:0
USB 鼠标模拟的坐标一直不准,请教.
代码是网上下载的那个 模拟USB鼠标的 ,用MouseClassServiceCallback的函数.
我的分辨率是1280*800 但是我用 IOCTL_MOUSE_MOVE_ABSOLUTE 设置坐标100,100. 结果几乎移动到屏幕0,0处了. 坐标1000,1000. 移动到19,12的位置 IOCTL_MOUSE_MOVE_RELATIVE 用这个的话,正向移动没问题,也就是说LastX,LastY多大于零的时候. 当反响就有问题了....LastX,LastY,同时小于某个值的时候,就移动到0,0处了... 不知道为什么呢? 请教... 谢谢. case IOCTL_MOUSE_MOVE_RELATIVE: { mid.Flags = MOUSE_MOVE_RELATIVE; //相对坐标 goto __MouseMoveCallBack; } case IOCTL_MOUSE_MOVE_ABSOLUTE: { mid.Flags = MOUSE_MOVE_ABSOLUTE; //绝对坐标 goto __MouseMoveCallBack; } case IOCTL_MOUSE_VIRTUAL_DESKTOP: { mid.Flags = MOUSE_VIRTUAL_DESKTOP; //虚拟桌面 __MouseMoveCallBack: mid.UnitId = 1; mid.Buttons = 0; mid.RawButtons = 0; mid.LastX = *((ULONG*)ioBuf); mid.LastY = *((ULONG*)ioBuf+1); mid.ExtraInformation = 0; InputDataStart = ∣ InputDataEnd = InputDataStart+1; orig_MouseClassServiceCallback( g_mouDeviceObject, InputDataStart, InputDataEnd, &InputDataConsumed ); status = STATUS_SUCCESS; break; } |
|