Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

IMMDeviceEnumerator::GetDevice method

The GetDevice method retrieves an audio endpoint device that is identified by an endpoint ID string.

Syntax


HRESULT GetDevice(
  [in]   LPCWSTR pwstrId,
  [out]  IMMDevice **ppDevice
);

Parameters

pwstrId [in]

Pointer to a string containing the endpoint ID. The caller typically obtains this string from the IMMDevice::GetId method or from one of the methods in the IMMNotificationClient interface.

ppDevice [out]

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.

Return value

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.

Return codeDescription
E_POINTER

Parameter pwstrId or ppDevice is NULL.

E_NOTFOUND

The device ID does not identify an audio device that is in this system.

E_OUTOFMEMORY

Out of memory.

 

Remarks

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:

  1. The first program calls the IMMDevice::GetId method in the first process to obtain the endpoint ID string that identifies the device.
  2. The first program passes the endpoint ID string across the process boundary to the second program.
  3. To obtain a reference to the device's IMMDevice interface in the second process, the second program calls GetDevice with the endpoint ID string.

For more information about the GetDevice method, see the following topics:

For code examples that use the GetDevice method, see the following topics:

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Mmdeviceapi.h

See also

IMMDevice Interface
IMMDevice::GetId
IMMDeviceEnumerator Interface
IMMNotificationClient Interface

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.