开发者

Detect removeable media

I want to detect when a removal media is inserted or removed from the PC and I have read many threads of how to do it.

Reading other threads and pages gives essential two m开发者_高级运维ethods

  1. Override WinProc method
  2. Make SQL query

There is a FileSystemWatcher class, is there reallý not a "DriveSystemWatcher" or something ?

Also, if I try the "SQL" approach it can not compile the program becosue it can not resolve "ManagementEventWatcher", even if I do

using System;

using System.Management;

Help would be appreciated

Regards Stefan.


In order to use classes from System.Management (so that you can query WMI) you need to add a reference to System.Management.dll to your project.

The following describes an approach using WMI when you've done this:

Detecting Eject/Insert of Removeable Media

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜