得到通知时,一个新的驱动器通过USB或其他方式连接的(C#) [英] Get notification when a new drive is connected via USB or other means (C#)

查看:134
本文介绍了得到通知时,一个新的驱动器通过USB或其他方式连接的(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过USB端口,FireWire端口等,以检测当一个新的驱动器插入Windows系统,我知道的WM_DEVICECHANGE 的消息,但是这需要一个窗口是为了用它打开。有没有一种方法来创建的背景的中,当新的驱动器在

I need to detect when a new drive is plugged into a Windows system through a USB port, firewire port, etc. I am aware of the WM_DEVICECHANGE message, but this requires a window to be open in order to use it. Is there a way to create a background process in C# that detects when new drives are plugged in?

背景信息插检测C#程序:我想写这个应用从公司可移动驱动器中删除蠕虫。常规防病毒软件不能删除。我们有一个脚本,将删除该蠕虫,但必须手动运行,这是不够好,以控制疫情。

Background info: I am wanting to write this app to remove a worm from company removable drives. Regular antivirus software is failing to removing it. We have a script that will remove the worm, but it must be run manually, which is not good enough to contain the outbreak.

推荐答案

一个窗口服务应该做的伎俩

尝试返工CodeProject上 DriveDetector 作为一种服务,你应该有你所需要的

Try reworking the CodeProject DriveDetector as a service and you should have what you need

这篇关于得到通知时,一个新的驱动器通过USB或其他方式连接的(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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