Detect if physical optical drive is present

545 views Asked by At

I need a method to detect if an optical DVD/CD drive is physically present on a computer. Not if a disc is inserted or not (unless that will help my goal).

Using DirectoryExists to me wouldn't always work because not everyone's optical disc drive is D:\ and wouldn't it return false even if there was a drive, but no disc was current inserted?

1

There are 1 answers

0
David Heffernan On

If you are prepared to restrict consideration to mapped volumes only you can follow this procedure:

  1. Call GetLogicalDrives to find which drive letters are mapped to a drive.
  2. For each mapped drive letter, call GetDriveType to determine whether or not the drive is an optical drive. An optical drive (CD, DVD, etc.) is identified as DRIVE_CDROM.