CustomQueryInterface - IDispatch and Aggregation

Rating:        Based on 1 rating
Reviewed:  1 review
Downloads: 1036
Released: Sep 10, 2009
Updated: Sep 11, 2009 by liji
Dev status: Beta Help Icon

Recommended Download

Example CustomQueryInterfaceSampleCode
example, 9379K, uploaded Sep 9, 2009 - 1036 downloads

Release Notes

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 (except IUnknown). 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

Note: This a VS2010 Beta2 solution. Please make sure you install VS2010 Beta2 or later before you open the sample. Use with VS2010 Beta1 or earlier is not supported.
Dev10 Beta2 download

Reviews for this release

Very useful demonstration code. I have used ICustomQueryInterface to resolve a problem with passing a referenced SAFEARRAY (i.e. SAFEARRAY**) as a parameter of a dispinterface-based event from an unmanaged COM server to a managed event handler in C#. ICustomQueryInterface allowed me to create an entire IDispatch-derived event handler class in C# which resolved the problem,
by limbioliong on Aug 10, 2016 at 5:22 AM