Search C # code to detect removable disk (usb flash)

I'm looking for a C # code snippet to tell me when a USB drive is connected to my computer in Windows Vista (or win7)

+5
source share
4 answers

Codeproject has a class called DriveDetector that sounds like it does what you want.

+12
source

Take a look at WM_DEVICECHANGE . This message should be sent when a disc is inserted.

+3
source

, , , , , . WMI System.Management, , .

, , . , , USB-.

+1

powershell, System.Management.ManagementEventWatcher WMI Win32_VolumeChangedEvent, , , PowerShell, .. :

http://www.nivot.org/nivot2/post/2008/08/16/AutoMountunmountNewPSDrivesForRemovableDrivesAndNetworkSharesInPowerShellV2.aspx

#, , script.

, .

0

All Articles