ICustomQueryInterface 介面

定義

警告

此 API 現已淘汰。

讓開發人員提供 IUnknown::QueryInterface(REFIID riid, void **ppvObject) 方法的自訂 Managed 實作。Enables developers to provide a custom, managed implementation of the IUnknown::QueryInterface(REFIID riid, void **ppvObject) method.

public interface class ICustomQueryInterface
[System.Runtime.InteropServices.ComVisible(false)]
[System.Obsolete("ICustomQueryInterface may be unavailable in future releases.")]
public interface ICustomQueryInterface
type ICustomQueryInterface = interface
Public Interface ICustomQueryInterface
屬性

備註

這個類別可讓「高級使用者」提供 QueryInterface 方法的自訂 managed 執行。This class permits advanced users to provide a customized managed implementation of the QueryInterface method.

Managed 和原生應用程式可以使用自訂的執行來傳回指定介面識別碼的特定介面,但 IID_IUnknown 除外。Managed and native applications can use the customized implementation to return a specific interface for a specified interface ID, except for IID_IUnknown. 也就是說,當呼叫 QueryInterface 時,如果其 riid 參數設定為 IID_IUnknown,則會忽略自訂的執行。That is, when QueryInterface is called, it will ignore custom implementations if its riid parameter is set to IID_IUnknown. 不過,您仍然可能會傳回IUnknown做為 ppvObjectHowever, you may still return IUnknown as the ppvObject.

開發人員可以為所有介面提供自訂的實作為(IUnknown除外),如果它們定義和執行有效的對應介面。Developers can provide custom implementations for all interfaces (except for IUnknown) if they define and implement a valid corresponding interface.

有效的使用者定義介面具有與非受控 COM 介面完全相符的 v 資料表配置,而且其 InterfaceTypeAttributeInterfaceIsIUnknownA valid user-defined interface has a v-table layout that matches the unmanaged COM interface exactly, and its InterfaceTypeAttribute is InterfaceIsIUnknown.

方法

GetInterface(Guid, IntPtr)

根據指定的介面 ID,傳回介面。Returns an interface according to a specified interface ID.

適用於