Consider the automation-compatible COM library in C#, given below. It follows a common COM pattern of having a visible factory coclass FooFactory implementing ICreateFoos wh
When QueryInterface is called against the IFoo
object returned from CreateFoo
for the IDispatch GUID it returns E_NOINTERFACE
unless ComVisible is set for the actual implementing class.
When jscript prepares to call the Foo
method it calls QueryInterface several times, including with this specific GUID, and since an error is returns it doesn't try to use Invoke
.
When vbscript prepares to call the Foo
method it does not check the interface supports IDispatch
. QueryInterface is called, once, with the GUID for IDispatchEx but it seems to simply assume IDispatch will be supported.