CustomQueryInterface
:school: Provide your own managed implementation of custom and standard COM interfaces
Install / Use
/learn @clrinterop/CustomQueryInterfaceREADME
CustomQueryInterface Sample
In the CLR v4 there is a new interface called
ICustomQueryInterface. This very cool new feature will enable developers to provide their own managed implementation of custom and standard COM interfaces (exceptIUnknown).
CustomQueryInterface Sample
One interesting scenario, which will be illustrated in the sample below,
is dynamic managed aggregation with a flexible implementation of IDispatch.
In this sample, we will show an implementation of ICustomQueryInterface through
a managed IDispatch implementation that overrides the default IDispatch
implementation by the CLR a managed COM aggregation system where both
Outer and Inner objects are managed objects.
CustomIMarshal Sample
To further demo the power of CustomQueryInterface and the ability to use
the .NET technology (WCF) within COM world, this sample targets the customization
of IMarshal interface by using WCF.
IMarshal enables a COM object to define and manage the marshaling of its interface
pointers. On the other hand, WCF provides serialization facilities that enable loose
coupling, which significantly eases the customization of IMarshal and makes it
more flexible.
In this sample, we provide three important things:
- A managed class acts as the COM component which also implements a WCF service.
- A managed class acts as the COM proxy which contains the WCF client.
- A program that demos the usage of the two classes above by passing the
IUnknownpointer through the global stream.
License
The CustomQueryInterface and CustomIMarshal samples are licensed under Microsoft Limited Public License (Ms-LPL).
Ms-LPL is based on Microsoft Public License (Ms-PL), but there is a Windows-platform limitation:
4. (F) Platform Limitation- The licenses granted in sections 2(A) & 2(B) extend only to the software or derivative works that you create that run on a Microsoft Windows operating system product.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
