Hi folks,
I am working on a tool that integrates Dolphin with Visio 2000. In order to get events from Visio I had to define/implement a Sink interface as the addAdvise() implemented by Visio (actually many of their components) requires references to this interface (for now on: IVisioSink). IVisioSink has one method #VisEventProc:ipSource:dwEventID:dwSeq:ipSubject:VextraInfo: IVisioSink is subclass of IDispatch... I defined IVisioSink with the ATL wizard, and I used the ActiveX Component Wizard for uploading the .tlb and generating the IVisioSink class in my image (which it was really useful). Then I started working on the implementation of IVisioSink that is VisioSink. VisioSink is a subclass of COMInterfaceImp. VisioSink finally had to implement the following methods: #supportedInterfaces - which is clear why it is needed from #GetIDsOfNames:rgszNames:cNames:lcid:rgdispid: #Invoke:riid:lcid:wFlags:pdispparams:pvarResult:pexcepinfo:puArgErr: and of course: #VisEventProc:ipSource:dwEventID:dwSeq:ipSubject:VextraInfo: The implementation of #GetIDsOfNames:rgszNames:cNames:lcid:rgdispid: #Invoke:riid:lcid:wFlags:pdispparams:pvarResult:pexcepinfo:puArgErr: are borrowed from AXDualImp... It is almost clear that I should make VisioSink subclass of AXDualImp. Does it means that any implementation of an IDispatch interface has to be a subclass of AXDualImp? I did get that idea from the dolphin-wiki pages... Am I doing something wrong? Thanks! Federico |
"Matt Hurlbut" <[hidden email]> wrote in message
news:[hidden email]... > ... > I am working on a tool that integrates Dolphin with Visio 2000. In order > to get events from Visio I had to define/implement a Sink interface as > the addAdvise() implemented by Visio (actually many of their components) > requires references to this interface (for now on: IVisioSink). > IVisioSink has one method > #VisEventProc:ipSource:dwEventID:dwSeq:ipSubject:VextraInfo: > IVisioSink is subclass of IDispatch... >... > It is almost clear that I should make > VisioSink subclass of AXDualImp. Yes, that would probably be a good idea. When implementing a "dual" interface with a type library, the OS provides an efficient implementation of the IDispatch side of the interface using the information in the type library. AXDualImp just hooks into that. All you need do is to implement the custom methods, in this case #VisEventProc:ipSource:dwEventID:dwSeq:ipSubject:VextraInfo:, and AXDualImp provides the implementation of all the other IDispatch methods such that if an invocation is received via IDispatch, it will be forwarded on to your the custom method. >...Does it means that any implementation > of an IDispatch interface has to be a subclass of AXDualImp? I did get > that idea from the dolphin-wiki pages... Am I doing something wrong? No. In fact most event interfaces are not dual, but just pure "dispinterfaces". This is (or was) due to a limitation in VB, that may or may not exist anymore - basically it could only receive events through IDispatch. These days the same limitation almost certainly applies in most scripting languages, so event interfaces are usually still just dispinterfaces. However Dolphin can use and implement vtbl-based "custom" interfaces (or the vtbl part of a dual interface) much more efficiently, so this should be used in preference if available. Regards Blair |
Free forum by Nabble | Edit this page |