ughani
ughani

Reputation: 61

How to programmatically differentiate between cd drive and dvd drive without a disk media inserted?

I want to How to differentiate between cd drive and dvd drive without a disk media inserted.

As there are answers for disk media inserted present.

Upvotes: 3

Views: 534

Answers (2)

Matt
Matt

Reputation: 111

If you want to use the IMAPI provided by Windows, then you could also use code similar to:

// Depending on how you import the COM interface, the names of types and methods
// may differ slightly from the following example. You can either add a reference
// to the COM library in Visual Studio, or roll your own if you choose.

MsftDiscRecorder2 recorder = new MsftDiscRecorder2();
recorder.InitializeDiscRecorder(uniqueId);  // From MsftDiscMaster2
foreach (FeaturePageType feature in recorder.SupportedFeaturePages)
{
    if (feature == FeaturePageType.DvdRead)
    {
        return true;
    }
}
return false;

Upvotes: 0

عثمان غني
عثمان غني

Reputation: 2708

The only way I know to do this would be to get the WMI Win32_CDROMDrive instances on the machine, then check for DVD in the Name or DeviceId properties.

You may even have to go so far as to get the DeviceID from the isntance then check in the Registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum[DeviceIdHere]\Device Parameters, then check for the existance of a value named "DefaultDvdRegion". This won't exist for CDROM drives, but does for DVD drives.

Upvotes: 4

Related Questions