Best way to detect dvd insertion in drive c#
I tried using WMI to detect new media insertion in Disk Drive using following code. But is there managed solution like using loop in background thread with DriveInfo.GetDrives? Which is best way to do this? I'm getting 'Disk is not in the drive please insert disk' dialog with abort, retry and continue button on other pc when i tried the following code? On may machine it works fine. private void DriveWatcher() { try { var wqlEventQuery = new WqlEventQuery { EventClassName = "__InstanceModificationEvent", WithinInterval = new TimeSpan(0, 0, 1), Condition = @"TargetInstance ISA 'Win32_LogicalDisk