Thread t = new Thread(Flashwatcher); t.Start(); //... private void Flashwatcher() { ManagementScope scope = new ManagementScope("root\\CIMV2"); scope.Options.EnablePrivileges = true; WqlEventQuery query = new WqlEventQuery(); query.EventClassName = "__InstanceCreationEvent"; query.WithinInterval = new TimeSpan(0, 0, 1); query.Condition = @"TargetInstance ISA 'Win32_USBControllerdevice'"; watcher = new ManagementEventWatcher(scope, query); watcher.Start(); watcher.WaitForNextEvent(); }
c# Вставляем флэшку в компьютер и обрабатываем это событие
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.