本文实例讲述了C#检测pc光驱里是否插入了光盘的方法。分享给大家供大家参考。具体如下:
C# 检测pc光驱里是否插入了光盘,需要添加System.Management.dll 的引用
using System;
using System.Management;
namespace CDROMManagement
{
class WMIEvent
{
static void Main(string[] args)
{
WMIEvent we = new WMIEvent();
ManagementEventWatcher w = null;
WqlEventQue