Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

IDispatch And IUnknow

viswaviswa Member Posts: 1
Hi

I'm learning COM/DCOM i wanted to know when we need to use IUnknown and IDispatch Standard Interface.

viswa



Comments

  • ColdShineColdShine Member Posts: 597
    You use IUnknown when you want a safe way for pointers to be passed to a function, or to be casted to a superclass/subclass.

    The IDispatch is useful when you want to pass a pointer to something you only want to have certain members, that allows you to dispatch a certain property without knowing the interfaces which provides it.
    E.g. maybe different interfaces have a member called "Caption", you can call it on any of these interfaces and will succeed, while calling it on an interface which doesn't support it will result in an error HRESULT return value.
    When you want a fixed set of members, you just create an IUnknown-inheriting interface, and simply pretend an object of that class only.
    _____________________________
    [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b]
    http://www16.brinkster.com/rafonline[/size]


Sign In or Register to comment.