如何在MFC中获取进程(PID为4)使用的HID设备句柄 [英] How to get HID device handle which is used by process(PID is 4 ) in MFC

查看:272
本文介绍了如何在MFC中获取进程(PID为4)使用的HID设备句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用CreateFile来获取HID设备句柄,它给我一个错误代码32.我发现某些进程已经独占地打开它。所以我使用ProcessExplorer找到进程并发现它的PID是4.



有没有办法获得该进程占用的HID设备句柄? br />
这里我如何使用CreateFile

I use CreateFile to get the HID device handle and it give me a error code 32. I figure out that some process has opend it exclusively. So I use ProcessExplorer to find the process and find out it's PID is 4.

Is there any way to get the HID device handle which is occupied by that process?
Here how I use CreateFile

hOut = CreateFile(devPath, 
                  GENERIC_READ | GENERIC_WRITE, 
                  FILE_SHARE_READ | FILE_SHARE_WRITE, 
                  NULL, 
                  OPEN_EXISTING, 
                  FILE_ATTRIBUTE_NORMAL, 
                  NULL);

推荐答案

I只是想问一下与你类似的问题。

我的问题是如何在代码中打开HID设备的过程,然后,释放句柄,终止进程。最后,打开HID设备成功。
I just want to ask the question which is similar to yours.
My problem is how to get the process which open the HID device in code, then, release the handle,kill the process.finally, open the HID device successfully.


这篇关于如何在MFC中获取进程(PID为4)使用的HID设备句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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