IAudioEndpointVolume::UnregisterControlChangeNotify

Previous Next

IAudioEndpointVolume::UnregisterControlChangeNotify

The UnregisterControlChangeNotify method deletes the registration of a client's notification callback interface that the client registered in a previous call to the IAudioEndpointVolume::RegisterControlChangeNotify method.

HRESULT UnregisterControlChangeNotify(
  IAudioEndpointVolumeCallback  *pNotify
);

Parameters

pNotify

[in]  Pointer to the client's IAudioEndpointVolumeCallback interface. The client passed this same interface pointer to the endpoint volume object in a previous call to the IAudioEndpointVolume::RegisterControlChangeNotify method. If the UnregisterControlChangeNotify method succeeds, it calls the Release method on the client's IAudioEndpointVolumeCallback 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.

Remarks

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

For a code example that calls UnregisterControlChangeNotify, see Endpoint Volume Controls.

Requirements

Client: Windows Vista

Header: Include Endpointvolume.h.

See Also

Previous Next