2

If I create a COM-visible VB.NET interface, such as:

<ComVisible(True)>
Public Interface IMyInterface
    Sub MyMethod()
End Interface

Then the resulting type library will show IMyInterface inheriting IDispatch. Is there a way to inherit just IUnknown, and not IDispatch?

tenfour
  • 36,141
  • 15
  • 83
  • 142

1 Answers1

2

Use the InterfaceTypeAttribute Class like this:

<ComVisible(True), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IMyInterface
    Sub MyMethod()
End Interface
Simon Mourier
  • 132,049
  • 21
  • 248
  • 298