tags:

views:

21

answers:

1

Hi,

I am trying to use the following code in my project. http://www.codeproject.com/KB/miscctrl/imapi2.aspx

However, When I run the application and click on "Detect Media" it says "Media not supported".

Can someone please help me with this issue. Why does it say Media not supported?

Thank you, Divya.

A: 

Referring to Eric's source code for the application, this text comes from the buttonDetectMedia_Click method in the MainForm class:

discFormatData = new MsftDiscFormat2Data();
if (!discFormatData.IsCurrentMediaSupported(discRecorder))
{
    labelMediaType.Text = "Media not supported!";
    _totalDiscSize = 0;
    return;
}

So, the call to IsCurrentMediaSupported is failing. This is actually a COM Interop call to IDiscFormat2::IsCurrentMediaSupported. The MSDN documentation does mention some other possible HRESULT values, though I'd expect that if they occurred, a COMException would be thrown. The sample code does catch this exception, in which case a message box is displayed - that's not the case here though.

When I ran the sample, I got the same "Media not supported!" error. I have a DVD burner, but there is no disc in the drive (don't have any blank discs with me at the moment!), so that appears to be one answer to why you'd get that message. I'd guess if the media in the drive was not writable or incompatible with your burner, you'd also get that message.

David Gardiner