2 只老鼠,但使用 Visual Basic 2008 Express 跟踪 1 只老鼠的坐标
对 VB 完全陌生,但有一些在 Excel 中使用 VBA 的经验。
我想做的是使用 Visual Basic 2008 Express 制作一个表单,通过 USB 适配器跟踪旧 PS/2 鼠标的坐标,然后以度:分:秒为单位显示 2 个旋转位置。我计划使用该鼠标内部的旋转编码器作为旋转读取器,以显示 2 个轴彼此成 90 度的旋转位置。虽然当我移动鼠标时,我可以使用简单的形式在屏幕上显示坐标,但我希望能够在可能的情况下“隐藏”其光标,同时仍然跟踪 2 个轴编码器的旋转,然后使用笔记本电脑上的鼠标垫,用于在窗口中导航,独立执行正常任务。我能够校准 PS/2 鼠标中的旋转编码器,它足够准确,可以满足我的需要。本质上,我想使用旧的 PS/2 鼠标作为输入位置传感器,同时保留鼠标垫的预期用途。
你认为这可以做到吗?
感谢您的帮助!!
totally new to VB however have some experience of using VBA in excel.
What I am trying to do is to make a form using Visual Basic 2008 Express that track the coordinates of aan old PS/2 mouse through a usb adapter and then show 2 rotary positions in deg:min:sec. I am planning on using the rotary encoders inside this mouse as a rotational reader to show rotary position of 2 shafts at 90 Deg to each other. Whilst I can get the coords to show on the screen using a simple form as I move the mouse around, I want to be able to "hide" its cursor if possible whilst still tracking the rotation of the 2 shaft encoders, and then use the mouse pad on the laptop for navigating around windows performing normal tasks independently. I am able to calibrate the rotary encoders in the PS/2 mouse and it is accurate enough for what i need. In essence, I want to use the old PS/2 mouse as an input positional sensor whilst keeping the mouse pad for its intended use.
Do you think this can be done??
Thanks for your help!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我喜欢这个问题。没有任何可视化表明你正在尝试做的事情是不是很棒的。然而,以让另一个鼠标独自使用的方式来完成此操作(请原谅双关语,它自己的设备)将很困难,因为据我了解,您将需要防止鼠标事件到达指针堆栈,这将涉及编写您自己的鼠标驱动程序。这在 VB 中是非常非常困难的,而这正是 C++ 所擅长的。
与 VBA 相比,C++ 也很难学。对不起!另一种选择是设置一台专用机器作为输入处理程序,并让它通过网络传输旋转数据。根据您的延迟容忍度,您甚至可以使用 VBA 通过 HTTP 来完成此操作!
这并不理想,HTTP 协议固有的开销很大,因为它并不是真正为像这样的大量小移动数据包而构建的,但在本地网络上它可能足够好(并且可以节省您的时间)还需要弄清楚套接字。)
I love this question. There is no visualization of what you are trying to do that is not awesome. However, accomplishing this in a way which leaves the other mouse to its own - pardon the pun, its own devices - will be difficult, because as I understand it you are going to need to prevent the mouse events from reaching the pointer stack, which is going to involve writing your own mouse driver. This is going to be really, really hard in VB and is precisely the sort of thing which C++ is good for.
C++ is also hard as heck to learn compared to VBA. Sorry! Another option would be to set up a dedicated machine as your input handler and have it stream rotational data over the network. Depending on your latency tolerance, you could even do this over HTTP with VBA!
This wouldn't be ideal, there is a lot of overhead inherent in the HTTP protocol because it isn't really built for lots of little movement packets like this, but over a local network it is likely to be good enough (and saves you needing to figure out sockets just yet.)