1

I have this code:

DriveInfo dr = new DriveInfo(@"E:\");

if (dr.IsReady == false)
{
  MessageBox.Show("Drive E: is not ready. Please insert a blank DVD medium.");
}

So, I insert a blank DVD in the drive and run the code. What am I missing?

Thanks a lot

Tiago Mussi
  • 801
  • 3
  • 13
  • 20
sparky
  • 375
  • 6
  • 22

1 Answers1

2

DriveInfo.IsReady on the blank DVD will return false.

If you need to distinguish if a blank disc is there, you'll need to use a different library. Here is a program that includes a interop wrapper around IMAPI2 (Window's Image Mastering API): http://www.codeproject.com/KB/miscctrl/imapi2.aspx

Use the interop wrapper and call

IDiscFormat2Data discFormatData = new MsftDiscFormat2Data();
if (discFormatData.CurrentMediaStatus == IMAPI_FORMAT2_DATA_MEDIA_STATE.IMAPI_FORMAT2_DATA_MEDIA_STATE_BLANK)
{
    ...
}
Josh
  • 903
  • 8
  • 15
  • I only need to know that the media inserted in my drive is a DVD can i accomplish this without utilizing IMAPI? – sparky Dec 14 '11 at 16:24
  • Well apparently the drive is "ready" when there is a formatted/mounted (i.e. non-blank) disc in it that it can read... – Josh Dec 15 '11 at 08:15