다음을 통해 공유


IMMDeviceEnumerator::UnregisterEndpointNotificationCallback

Previous Next

IMMDeviceEnumerator::UnregisterEndpointNotificationCallback

The UnregisterEndpointNotificationCallback method deletes the registration of a notification interface that the client registered in a previous call to the IMMDeviceEnumerator::RegisterEndpointNotificationCallback method.

HRESULT UnregisterEndpointNotificationCallback(
  IMMNotificationClient  *pNotify
);

Parameters

pNotify

[in]  Pointer to the client's IMMNotificationClient interface. The client passed this same interface pointer to the device enumerator in a previous call to the IMMDeviceEnumerator::RegisterEndpointNotificationCallback method. If the UnregisterEndpointNotificationCallback method succeeds, it calls the Release method on the client's IMMNotificationClient interface.

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 code Description
E_POINTER Parameter pNotify is NULL.
E_NOTFOUND The specified notification interface was not found.

Remarks

Before the client releases its final reference to the IMMNotificationClient interface, it should call UnregisterEndpointNotificationCallback to unregister the interface. Otherwise, the application leaks the resources held by the IMMNotificationClient and IMMDeviceEnumerator objects. Note that the IMMDeviceEnumerator::RegisterEndpointNotificationCallback method calls the client's IMMNotificationClient::AddRef method, and UnregisterEndpointNotificationCallback calls the IMMNotificationClient::Release method. If the client errs by releasing its reference to the IMMNotificationClient interface before calling UnregisterEndpointNotificationCallback, the device enumerator never releases its reference to the IMMNotificationClient interface. For example, a poorly designed IMMNotificationClient implementation might call UnregisterEndpointNotificationCallback from the destructor for the IMMNotificationClient object. In this case, the client will not call UnregisterEndpointNotificationCallback until the device enumerator releases its reference to the IMMNotificationClient interface, and the device enumerator will not release its reference to the IMMNotificationClient interface until the client calls UnregisterEndpointNotificationCallback. For more information about the AddRef and Release methods, see the discussion of the IUnknown interface in the Windows SDK documentation.

Requirements

Client: Windows Vista

Header: Include Mmdeviceapi.h.

See Also

Previous Next