TargetInstance ISA'Win32_SerialPort'“

C#,WPF,Windows 7,PC,Visaul Studio 2010

我试图通过这样做,当用户将一个COM端口连接到PC时,试图陷入困境

myCOMAddEventQue = new WqlEventQuery("__InstanceCreationEvent", "TargetInstance ISA 'Win32_SerialPort'"); myCOMAddEventQue.WithinInterval = TimeSpan.FromSeconds(1); myCOMAddWatcher = new ManagementEventWatcher(myCOMAddEventQue); myCOMAddWatcher.EventArrived += new EventArrivedEventHandler(COMAddEvent); myCOMAddWatcher.Start(); 

但是这会产生错误“ObjectDisposedException was unhandled”?

我能够通过捕捉USB记忆棒

  myDiscAddlEventQue = new WqlEventQuery("__InstanceCreationEvent", "TargetInstance ISA 'Win32_LogicalDisk' and (TargetInstance.DriveType = 2 or TargetInstance.DriveType = 4)"); 

为什么Windows为COM端口生成错误?

问候Stefan