自动检测插入的新USB大容量存储驱动器 [英] Automatically detecting new usb mass storage drives plugged in
本文介绍了自动检测插入的新USB大容量存储驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写一个应用程序来检测用于数据存储的USB大容量存储驱动器。我已经提出了这个代码
I''m writing an application which would detect usb mass storage drives for data storage. I''ve come up with this code
foreach(DriveInfo mydrive in DriveInfo.GetDrives())
{
if(mydrive.DriveType == DriveType.Removable)
{
...
}
}
这个工作正常,当我有一个刷新按钮来完成这段代码。但是我希望它能够在插入时立即检测到新的驱动器。有人可以帮我解决这个问题。在此先感谢。
This works fine when i have a refresh button to go through the piece of code. But i want to make it to detect new drives as soon as they''re plugged-in. Can someone help me out with this. Thanks in advance.
推荐答案
看这里:在C#程序中检测USB驱动器的移除 [ ^ ]。该文章也涉及设备插入。
Look here: Detecting USB Drive Removal in a C# Program[^]. The article is covering device insertion also.
这篇关于自动检测插入的新USB大容量存储驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文