Visio and Dolphin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Visio and Dolphin

Plumber
Anyone tried to program Microsoft Visio with Dolphin yet ? I managed
to control all Visio functions, but can not set callback function to
capture events.
    Please Help !!!
   -Plumber


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Ian Bartholomew-17
>   Anyone tried to program Microsoft Visio with Dolphin yet ? I managed
> to control all Visio functions, but can not set callback function to
> capture events.

I've appended a couple of posts from the newsgroup archive, a question amd
Blair's answer, that may or may not help?  There are a couple of other
comments about Visio in the archive, nothing particularly concrete, so it
does look like others have travelled the same path.

Ian

~-~-~-~-~-~
From: Matt Hurlbut
Sent: 16:40:00, 12 March 2002
Subject: COM: Interface Implementation question

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

~-~-~-~-~-~
From: Blair McGlashan
Sent: 10:41:00, 13 March 2002
Subject: Re: Interface Implementation question

"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


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Federico Balaguer-2
In reply to this post by Plumber
Plumber <[hidden email]> wrote in message news:<[hidden email]>...
> Anyone tried to program Microsoft Visio with Dolphin yet ? I managed
> to control all Visio functions, but can not set callback function to
> capture events.
>     Please Help !!!
>    -Plumber
I did manage to get events from Visio. Visio does not implement the
standard way to build sinks. You have to build a separate COMInterface
for that. I got the specification of the function that the interface
should expose from "Developing Visio Solution", it should part of your
installation CD.  There is a chapter that talks about Automation.
I built a .tlb using Visual Stutio Wizard and then feed Dolphin with
that. Then I implemented the sink as a DualInterface.
I am away from my office now, but I can share the Smalltalk code with
you. I don't have the tlb around and I am not sure if you can register
the sink interface without it. Please let me know.

Regards Federico


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Plumber
In reply to this post by Ian Bartholomew-17
Thank you very much for the help, as I am not that proficient in COM
terminology.
Also, following the Autoplay example I have finaly managed to get the events
from Visio by menas  Dolphin provides - AXControlSite, AXEventSink etc. Do I
still
miss something ? Is this any worse then the functionality provided by
Visio..addAdvise() ?
    Thanks again,
   -plumber


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Federico Balaguer-2
Plumber <[hidden email]> wrote in message news:<[hidden email]>...
> Thank you very much for the help, as I am not that proficient in COM
> terminology.
> Also, following the Autoplay example I have finaly managed to get the events
> from Visio by menas  Dolphin provides - AXControlSite, AXEventSink etc. Do I
> still
> miss something ? Is this any worse then the functionality provided by
> Visio..addAdvise() ?
>     Thanks again,
>    -plumber

Where did you find the Autoplay example? I browse on this newsgroup
but I didn't find any reference to it. I am not sure what you got, but
if you are able to register to different events and then get the
visEventProc call,your solution is as good as it gets :-)

Federico


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Plumber
visioShell := AXControlSite progId: 'Visio.Application'.
.....
(visioShell sink - an AXEventSink)
visioShell when: #CellChanged: send #CellChanged to: ........

Dolphin XP, Visio 2002.
Is this more slow then addAdvise ? I could not get the last one working

-plumber


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Federico Balaguer-2
Plumber <[hidden email]> wrote in message news:<[hidden email]>...
> visioShell := AXControlSite progId: 'Visio.Application'.
> .....
> (visioShell sink - an AXEventSink)
> visioShell when: #CellChanged: send #CellChanged to: ........
>
> Dolphin XP, Visio 2002.
> Is this more slow then addAdvise ? I could not get the last one working
>
> -plumber

Sorry but I don't understand if this code is able to get events from
Visio2002 or not. I tried a similar approach time ago with Visio2000
and it didn't work because addAdvise() was the only way to register to
events/dispatch back then.

Federico


Reply | Threaded
Open this post in threaded view
|

Re: Visio and Dolphin

Plumber
Federico

openVisio
 control := VisioControlSite progId: 'Visio.Application'.
 control controlDispatch documents open: 'c:\plumber\plumb.vsd'

I have
AXControlSite subclass: #VisioControlSite so it does not create generic IDispatch, but the
one ftom Visio Type Library.
Now I can say, for instance, control when: #EventSelector: send: #EventSelector: to:
myEventHandler, and it all works just fine, except that Visio is about 5 times slower then
usual.

 -plumber