Lokanath Nayak
Lokanath Nayak

Reputation: 87

MFC/WINAPI: How to check the DVD drive is present in machine

I want to check whether the DVD writer is present or not in my machine using MFC/WinAPI. Could anyone please help on this.

Thank

Upvotes: 0

Views: 153

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69652

You can enumerate DVD drivers and their capabilities using IMAPI2, IDiscRecorder2 interface:

To retrieve a list of devices on the computer and their unique identifiers, call the IDiscMaster2::get__NewEnum method.

Then IDiscRecorder2::get_SupportedProfiles method:

List of MMC profiles that the device supports.

typedef enum _IMAPI_PROFILE_TYPE { 
  IMAPI_PROFILE_TYPE_INVALID                     = 0,
  IMAPI_PROFILE_TYPE_NON_REMOVABLE_DISK          = 0x1,
  IMAPI_PROFILE_TYPE_REMOVABLE_DISK              = 0x2,
  IMAPI_PROFILE_TYPE_MO_ERASABLE                 = 0x3,
  IMAPI_PROFILE_TYPE_MO_WRITE_ONCE               = 0x4,
  IMAPI_PROFILE_TYPE_AS_MO                       = 0x5,
  IMAPI_PROFILE_TYPE_CDROM                       = 0x8,
  IMAPI_PROFILE_TYPE_CD_RECORDABLE               = 0x9,
  IMAPI_PROFILE_TYPE_CD_REWRITABLE               = 0xa,
  IMAPI_PROFILE_TYPE_DVDROM                      = 0x10,
  IMAPI_PROFILE_TYPE_DVD_DASH_RECORDABLE         = 0x11,
  IMAPI_PROFILE_TYPE_DVD_RAM                     = 0x12,
  IMAPI_PROFILE_TYPE_DVD_DASH_REWRITABLE         = 0x13,
  // (and there is more!)

Also, IMAPI_FEATURE_PAGE_TYPE enumeration, which all together give you detail what the drive is capable to do (whether it can write and what exactly):

... defines values for the feature that are supported by the logical unit (CD and DVD device).

Upvotes: 1

Related Questions