The mciGetDeviceIDFromElementID function retrieves the MCI device identifier corresponding to an element identifier.

MCIDEVICEID mciGetDeviceIDFromElementID(
  DWORD dwElementID,
  LPCTSTR lpstrType



The element identifier.


Pointer to a null-terminated string specifying the type name that corresponds to dwElementID.

Return Values

Returns the device identifier assigned to the device when it was opened if successful. The identifier is used in the mciSendCommand function. If the element ID is not known, if the value of lpstrType is NULL, if the device is not open, or if there was not enough memory to complete the operation, the return value is zero.


Each file for a compound device has a unique device identifier. The identifier of the "all" device is MCI_ALL_DEVICE_ID.

For UNICODE, this method calls mciGetDeviceIDFromElementIDW, which defines the parameter lpstrType as type LPCWSTR.


**  Windows NT/2000/XP:** Included in Windows NT 3.1 and later.
**  Windows 95/98/Me:** Included in Windows 95 and later.
**  Header:** Declared in Mmsystem.h; include Windows.h.
**  Library:** Use Winmm.lib.
**  Unicode:** Implemented as Unicode and ANSI versions on Windows NT/2000/XP.

See Also

MCI, MCI Functions