ikathegreat
ikathegreat

Reputation: 2321

Detect if physical optical drive is present

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?

Upvotes: 1

Views: 555

Answers (1)

David Heffernan
David Heffernan

Reputation: 612954

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.

Upvotes: 7

Related Questions