[英]Catching 'external drive inserted' event in a windows service
I'm trying to write a super-simple podcast-to-device downloading service to use for running. 我正在尝试编写一个超级简单的播客到设备下载服务来运行。 I imagine that it'll like this:
我想它会是这样的:
Whenever a particular device is plugged in (via USB), it: 每当插入特定设备(通过USB)时,它:
I have some passing experience with windows services, but am not sure how to (using .NET/C#) catch the 'media device/usb hard drive has been plugged in' event. 我有一些Windows服务的传递经验,但我不知道如何(使用.NET / C#)捕获'媒体设备/ usb硬盘插入'事件。 Any advice?
有什么建议?
The simplest solution would be to periodically enumerate the devices! 最简单的解决方案是定期枚举设备!
CodeProject has a comprehensive C# article for this here : http://www.codeproject.com/KB/system/DriveDetector.aspx CodeProject有一篇全面的C#文章: http : //www.codeproject.com/KB/system/DriveDetector.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.