c# - default property when Com interface type is IDispatch -


in c# com interface, 1 can define default member this

[interfacetype(cominterfacetype.interfaceisdual)] [comvisible(true)] public interface imycomclass {     [dispid(0)] string item{get;} } 

with idispatch (or dual) works expected, , vba can omit property this

dim o1 new mycomclass debug.print o1 'this equivalent o1.item 

but if define interface iunknown, doesn't work. in excel object browser still see property marked 'blue dot', , labelled 'default member'. .item must explicitly specified in vba code.

is there way have default properties in iunknown behave in idispatch?

no, default properties notion can apply idispatch derived interfaces. late binding use in debug.print statement cannot work on iunknown interfaces, coclass implements interface doesn't have machinery required call function selected number.

review idispatch::invoke() method, that's 1 gets job done. using default member done passing 0 first argument.

dismiss quirks you'd see in object browser, assumes com objects support automation.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -