Windows服务检测USB [英] windows service detect usb

查看:85
本文介绍了Windows服务检测USB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我发现很多程序都在c#中检测usb设备。

但是我需要制作 windows service 程序检测usb。

有人可以帮助我???


I found a lot of programs that detect usb devices in c#.
but i need to make windows service program that detect usb.
can someone help me???

推荐答案

在visual studio中创建新的Windows服务项目..


这就是
just create new windows service project in visual studio..

thats it


它不会帮助我。我现在使用的所有程序都是从窗口捕获消息的表单。

表单不能在sindows服务中
it dosen''t help me. all the programs I now are with forms that catching messages from windows.
forms are not abled in sindows service


你可以使用WMI类。

Win32_DeviceChangeEvent在添加或删除设备时触发。

您可以关闭该事件以检查您想要的设备是否存在


用PnPDevice绑定:
You can probably use WMI classes.
Win32_DeviceChangeEvent triggers when devices are added or removed.
You could probably key off that event to check to see if the device you wanted exists


Tie it in with PnPDevice:
展开 | 选择 | Wrap | 行号


这篇关于Windows服务检测USB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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