IMMDeviceEnumerator::GetDevice method (mmdeviceapi.h)
The GetDevice method retrieves an audio endpoint device that is identified by an endpoint ID string.
HRESULT GetDevice( [in] LPCWSTR pwstrId, [out] IMMDevice **ppDevice );
Pointer to a pointer variable into which the method writes the address of the IMMDevice interface for the specified device. Through this method, the caller obtains a counted reference to the interface. The caller is responsible for releasing the interface, when it is no longer needed, by calling the interface's Release method. If the GetDevice call fails, *ppDevice is NULL.
If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.
||Parameter pwstrId or ppDevice is NULL.|
||The device ID does not identify an audio device that is in this system.|
||Out of memory.|
If two programs are running in two different processes and both need to access the same audio endpoint device, one program cannot simply pass the device's IMMDevice interface to the other program. However, the programs can access the same device by following these steps:
- The first program calls the IMMDevice::GetId method in the first process to obtain the endpoint ID string that identifies the device.
- The first program passes the endpoint ID string across the process boundary to the second program.
- To obtain a reference to the device's IMMDevice interface in the second process, the second program calls GetDevice with the endpoint ID string.
|Minimum supported client||Windows Vista [desktop apps only]|
|Minimum supported server||Windows Server 2008 [desktop apps only]|