IMMDeviceEnumerator::UnregisterEndpointNotificationCallback 方法 (mmdeviceapi.h)
UnregisterEndpointNotificationCallback 方法會刪除用戶端在先前呼叫 IMMDeviceEnumerator::RegisterEndpointNotificationCallback 方法中註冊的通知介面註冊。
語法
HRESULT UnregisterEndpointNotificationCallback(
[in] IMMNotificationClient *pClient
);
參數
[in] pClient
用戶端 IMMNotificationClient 介面的指標。 用戶端在先前呼叫 IMMDeviceEnumerator::RegisterEndpointNotificationCallback 方法中,將這個相同的介面指標傳遞至裝置列舉值。 如需詳細資訊,請參閱<備註>。
傳回值
如果方法成功,它會傳回 S_OK。 如果失敗,可能的傳回碼包括,但不限於下表所示的值。
傳回碼 | Description |
---|---|
|
參數 pNotify 為 NULL。 |
|
找不到指定的通知介面。 |
備註
客戶端必須確保在 RegisterEndpointNotificationCallback 呼叫之後,以及呼叫 UnregisterEndpointNotificationCallback 之前,不會釋放 IMMNotificationClient 物件。 這些方法不會呼叫用戶端的 IMMNotificationClient::AddRef 和 IMMNotificationClient::Release 實作。 用戶端負責維護 IMMNotificationClient 對象的參考計數。 如果 RegisterEndpointNotificationCallback 呼叫成功,而且只有在呼叫 UnregisterEndpointNotificationCallback 或實作其他機制之後,用戶端才能遞增計數,以確保呼叫 UnregisterEndpointNotificationCallback 之前不會刪除物件。 否則,應用程式會洩漏 IMMNotificationClient 所持有的資源,以及相同容器中實作的任何其他物件。
如需 AddRef 和 Release 方法的詳細資訊,請參閱 Windows SDK 檔中的 IUnknown 介面討論。
規格需求
需求 | 值 |
---|---|
最低支援的用戶端 | Windows Vista [僅限傳統型應用程式] |
最低支援的伺服器 | Windows Server 2008 [僅限傳統型應用程式] |
目標平台 | Windows |
標頭 | mmdeviceapi.h |