为什么usb鼠标不向mchid应用程序发送数据 [英] Why usb mouse don't send data to the mchid application

查看:95
本文介绍了为什么usb鼠标不向mchid应用程序发送数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

i使用mcHID与USB鼠标接口,我可以获得Vendor_ID和Product_ID ..等等
我不能得到的是Notify_read。

插入时我只能读取一次数据。

是否有解决方案可以连续获得鼠标位置。

谢谢。



我尝试过:



使用delphi和mcHID.dll的接口

Hello
i am using mcHID to interface with USB mouse, i can get Vendor_ID and Product_ID ..etc
what i can't get is the Notify_read.
I can read data only one time when it's plugged.
Is there a solution to get mouse position continuously.
Thank you.

What I have tried:

an Interface using delphi and the mcHID.dll

推荐答案

为什么使用某种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]


这篇关于为什么usb鼠标不向mchid应用程序发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆