You can achieve this using the IMAPI v2 API.
Once you have the correct links in your .NET project, as well as the various enumerations defined in this API (and there are quite a few!), The code is relatively simple. Something like (pseudo-code):
IDiscRecorder2 discRecorder = (IDiscRecorder2)[*cd/dvd drive*];
discFormatData.Recorder = discRecorder;
IMAPI_MEDIA_PHYSICAL_TYPE mediaType = discFormatData.CurrentPhysicalMediaType;
string mediaTypeString = GetMediaTypeString(mediaType);
where:
IMAPI_MEDIA_PHYSICAL_TYPE is an enum such like:
public enum IMAPI_MEDIA_PHYSICAL_TYPE
{
IMAPI_MEDIA_TYPE_UNKNOWN = 0,
IMAPI_MEDIA_TYPE_CDROM = 1,
IMAPI_MEDIA_TYPE_CDR = 2,
IMAPI_MEDIA_TYPE_CDRW = 3,
IMAPI_MEDIA_TYPE_DVDROM = 4,
IMAPI_MEDIA_TYPE_DVDRAM = 5,
[not the complete enum...snipped for brevity!]
}
and the "GetMediaTypeString" function simply gives a friendly string
representation of the enum name.
- CodeProject, :
CD/DVD/Blu-ray # IMAPI2
, (, !), / .
:
, MsftDiscFormat2Data Recorder. IDiscFormat2Data CurrentPhysicalMediaType.
, , MsftFileSystemImage ChooseImageDefaultsForMediaType .