How i found only my CD/DVD drive not any other HDD,flash drive or virtual drive.
& the status is there has any cd present or not.
Thank you in advance. :)
Finding CD drive not Virtual Drive
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Mamta MRank #268 · 9.4K reputationPosted Aug 3, 2010, 2:14 AM EDT
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
foreach (System.IO.DriveInfo drive in drives)
{
if (drive.DriveType == System.IO.DriveType.CDRom)
Console.WriteLine(drive.Name);
}
Mamta MRank #268 · 9.4K reputationPosted Aug 3, 2010, 2:19 AM EDT
Tanmay SarkarRank #1,407 · 1.2K reputationPosted Aug 3, 2010, 2:38 AM EDT
I wrote this code before posting my problem.
this code can't say the drive is virtual or not. :)
So I write this post to not showing any virtual drive.
thanks for your response & time. :)
And for your question, I am just crop a picture from my collection, I am not edit it :)
Thanks for your complement. :)