Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ICustomQueryInterface Interface

.NET Framework (current version)
 

Enables developers to provide a custom, managed implementation of the IUnknown::QueryInterface(REFIID riid, void **ppvObject) method.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

[ComVisibleAttribute(false)]
public interface ICustomQueryInterface

NameDescription
System_CAPS_pubmethodGetInterface(Guid, IntPtr)

Returns an interface according to a specified interface ID.

This class permits advanced users to provide a customized managed implementation of the QueryInterface method.

Managed and native applications can use the customized implementation to return a specific interface for a specified interface ID, except for IID_IUnknown. That is, when QueryInterface is called, it will ignore custom implementations if its riid parameter is set to IID_IUnknown. However, you may still return IUnknown as the ppvObject.

Developers can provide custom implementations for all interfaces (except for IUnknown) if they define and implement a valid corresponding interface.

A valid user-defined interface has a v-table layout that matches the unmanaged COM interface exactly, and its InterfaceTypeAttribute is InterfaceIsIUnknown.

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2017 Microsoft