且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么usb鼠标不向mchid应用程序发送数据

更新时间:2023-11-05 16:20:46

为什么使用某种DLL来访问USB鼠标而不是使用使用Windows API的Delphi鼠标事件?



mcHID DLL用于访问低级别的USB设备。



我没有使用Delphi所以很快,但一项快速研究表明,有一个 OnMouseMove 事件。如果您需要在屏幕上的任何位置获取位置( OnMouseMove 仅在鼠标处理窗口时调用),您可以轮询位置(例如使用计时器) )并致电 Mouse.CursorPos



[更新]

Why you are using some kind of DLL to access an USB mouse instead of using the Delphi mouse events that use the Windows API?

The mcHID DLL is for accessing USB devices on a low level.

I have not used Delphi so far, but a quick research shows that there is an OnMouseMove event. If you need to get the position anywhere on your screen (OnMouseMove is only called when the mouse is over the window handling it), you can poll the position (e.g. using a timer) and call Mouse.CursorPos.

[UPDATE]
引用(由于注释因评论无效而发布的评论):
Quote (from comment posted as solution due to comments not working):

谢谢,也许我应该解释一下,我正在用PIC单片机构建USB接口发送和接收数据,我正在我的USB鼠标上测试软件。

我注意到Notify_Read从未发送任何我想知道USB鼠标是否未激活它的原因或什么?

非常感谢您的回复。

thank you, may be i should explain that i am building a USB Interface with PIC microcontroller to send and receive data, and i am testing the software on my USB mouse.
I noticed that the Notify_Read never sends anything that is why i want to know if the USB mouse does not activate it or what?
many thanks for the reply.

鼠标可能处于活动状态(我猜您正在使用它)。但这可能是问题所在:事件由Windows驱动程序处理,不会传递给DLL。



我知道评论选项实际上不起作用。但您可以使用绿色的改善问题链接编辑您的问题,以便在那里添加新信息。

[/ UPDATE]

The mouse is probably active (I guess you are using it). But that might be the problem: The events are handled by the Windows driver and are not passed through to the DLL.

I know that the comment option is actually not working. But you can edit your question with the green 'Improve question' link to add the new information there.
[/UPDATE]