public class MMDevice : ComObject
Encapsulates the generic features of a multimedia device resource.
MMDevice(IntPtr ptr)
Initializes a new instance of the MMDevice class.
public void MMDevice(IntPtr ptr)
Parameters
ptr
IntPtrNative pointer.
Remarks
Use the MMDeviceEnumerator class to create a new MMDevice instance.
Activate(Guid iid, CLSCTX context, IntPtr activationParams)
Creates a COM object with the specified interface.
public IntPtr Activate(Guid iid, CLSCTX context, IntPtr activationParams)
Parameters
iid
GuidThe interface identifier. This parameter is a reference to a GUID that identifies the interface that the caller requests be activated. The caller will use this interface to communicate with the COM object.
context
CLSCTXThe execution context in which the code that manages the newly created object will run.
activationParams
IntPtrUse Zero as the default value. See http://msdn.microsoft.com/en-us/library/windows/desktop/dd371405%28v=vs.85%29.aspx for more details.
Returns
A pointer variable into which the method writes the address of the interface specified by parameter iid.
ActivateNative(Guid iid, CLSCTX context, IntPtr activationParams, IntPtr& pinterface)
Creates a COM object with the specified interface.
public Int32 ActivateNative(Guid iid, CLSCTX context, IntPtr activationParams, IntPtr& pinterface)
Parameters
iid
GuidThe interface identifier. This parameter is a reference to a GUID that identifies the interface that the caller requests be activated. The caller will use this interface to communicate with the COM object.
context
CLSCTXThe execution context in which the code that manages the newly created object will run.
activationParams
IntPtrUse Zero as the default value. See http://msdn.microsoft.com/en-us/library/windows/desktop/dd371405%28v=vs.85%29.aspx for more details.
pinterface
IntPtr&A pointer variable into which the method writes the address of the interface specified by parameter iid.
Returns
HRESULT
Dispose(Boolean disposing)
Disposes the MMDevice and its default property store (see PropertyStore property).
GetIdNative(String& deviceid)
Retrieves an endpoint ID string that identifies the audio endpoint device.
public Int32 GetIdNative(String& deviceid)
Parameters
deviceid
String&The variable which will receive the id of the device.
Returns
HRESULT
GetStateNative(DeviceState& state)
Retrieves the current device state.
public Int32 GetStateNative(DeviceState& state)
Parameters
state
DeviceState&The variable which will receive the DeviceState of the device.
Returns
HRESULT
OpenPropertyStore(StorageAccess storageAccess)
Retrieves an interface to the device's property store.
public PropertyStore OpenPropertyStore(StorageAccess storageAccess)
Parameters
storageAccess
StorageAccessThe storage-access mode. This parameter specifies whether to open the property store in read mode, write mode, or read/write mode.
Returns
PropertyStore for the MMDevice.
OpenPropertyStoreNative(StorageAccess storageAccess, IntPtr& propertyStore)
Retrieves an interface to the device's property store.
public Int32 OpenPropertyStoreNative(StorageAccess storageAccess, IntPtr& propertyStore)
Parameters
storageAccess
StorageAccessThe storage-access mode. This parameter specifies whether to open the property store in read mode, write mode, or read/write mode.
propertyStore
IntPtr&A pointer variable into which the method writes the address of the IPropertyStore interface of the device's property store.
Returns
HRESULT
ToString()
Returns the FriendlyName of the MMDevice.
public String ToString()
Returns
The FriendlyName.
DeviceID
Gets the device id. For information, see .
public String DeviceID { get; }
DeviceState
Gets the device state of the device.
public DeviceState DeviceState { get; }
FriendlyName
Gets the friendly name of the device.
public String FriendlyName { get; }
Remarks
This value is stored in the PropertyStore.
PropertyStore
Gets the propertystore associated with the MMDevice.
public PropertyStore PropertyStore { get; }
Remarks
Warning: This PropertyStore is only readable. Use the OpenPropertyStore-Method to get writeable PropertyStore.