Implementing an MS Office COM Add-in using DST

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

Implementing an MS Office COM Add-in using DST

Keith  Lander-2
Has anyone managed to implement an Office COM Add-in using DST? More
specifically, has anyone implemented the IDTExtensibility2 interface. I have
tried several times but so far failed to persuade Word (the app I'm
interested in) to recognize the Add-in. I have to admit (head hanging down)
that I have been forced to resort to using VB - not because DST is
inadequate though, it is my COM expertise that is lacking and I grew fed up
of wrecking the registry!

Hope someone can clue me in, then I can try again using DST.

Best wishes
Keith


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Blair McGlashan
Keith

You wrote in message news:bbnvah$asu$[hidden email]...
> Has anyone managed to implement an Office COM Add-in using DST? More
> specifically, has anyone implemented the IDTExtensibility2 interface. I
have
> tried several times but so far failed to persuade Word (the app I'm
> interested in) to recognize the Add-in. I have to admit (head hanging
down)
> that I have been forced to resort to using VB - not because DST is
> inadequate though, it is my COM expertise that is lacking and I grew fed
up
> of wrecking the registry!
>
> Hope someone can clue me in, then I can try again using DST.

I've put together a sample that illustrates the basic requirements to have a
Dolphin COM add-in be recognised by MSWord. You can download it from:

http://www.object-arts.co.uk/

Basically all that is needed is:
1) A subclass of COMInterfaceImp that implements _IDTExtensibility2
2) Standard COM object registry entries (provided by Dolphin's default
COMInterfaceImp class>>register method as long as the subclass overrides
#progID and #clsid).
3) Some special registry entries that Word uses to find potential add-ins.

I've overridden #register in my sample class to create the latter set of
registry entries.

I'm afraid the add-in itself doesn't do anything useful - to make it do so
requires an understanding of the MS Office object model, which I don't have.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Blair McGlashan
"Blair McGlashan" <[hidden email]> wrote in message
news:bc4rcc$ffa57$[hidden email]...
>
> I've put together a sample that illustrates the basic requirements to have
a
> Dolphin COM add-in be recognised by MSWord. You can download it from:
>
> http://www.object-arts.co.uk/

Should have been:

http://www.object-arts.co.uk/downloads/samples/SampleWordAddIn.zip

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Keith  Lander-2
Hi Blair

I've tried building the add-in DLL and ended up with the same problem (same
effect actually, maybe a different problem). When I go to the Com Add-in
command in word and try to add the DLL Word just ignores it - no error, and
no entry in the add-in list.

Any ideas?

Cheers
Keith

"Blair McGlashan" <[hidden email]> wrote in message
news:bc4t52$fk6q0$[hidden email]...
> "Blair McGlashan" <[hidden email]> wrote in message
> news:bc4rcc$ffa57$[hidden email]...
> >
> > I've put together a sample that illustrates the basic requirements to
have

> a
> > Dolphin COM add-in be recognised by MSWord. You can download it from:
> >
> > http://www.object-arts.co.uk/
>
> Should have been:
>
> http://www.object-arts.co.uk/downloads/samples/SampleWordAddIn.zip
>
> Regards
>
> Blair
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Blair McGlashan
Keith

You wrote in message news:bc829s$shg$[hidden email]...
> Hi Blair
>
> I've tried building the add-in DLL and ended up with the same problem
(same
> effect actually, maybe a different problem). When I go to the Com Add-in
> command in word and try to add the DLL Word just ignores it - no error,
and
> no entry in the add-in list.
>
> Any ideas?

Presumably you did register (regsvr32.exe) the DLL after deployment?

Check the registry under HKCU/Software/Microsoft/Office/Word/Addins. There
should be a Dolphin.WordAddIn subkey with various values under it. Word uses
this information to populate the list of add-ins. Registering the DLL (or
sending #register to the class in the development image) will create these
keys.

If the add-in is correctly registered then it should appear in the COM
add-ins list after you start word without you actually having to do
anything. To get it to actually load you will need to 'check' it of course.

Were you able to get it to recognise the add-in having just registered it to
run in the development image (see the package comment)?

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Blair McGlashan
In reply to this post by Keith Lander-2
"Keith Lander" <[hidden email]> wrote in message
news:bc829s$shg$[hidden email]...
> Hi Blair
>
> I've tried building the add-in DLL and ended up with the same problem
(same
> effect actually, maybe a different problem). When I go to the Com Add-in
> command in word and try to add the DLL Word just ignores it - no error,
and
> no entry in the add-in list.
>
> Any ideas?

One other thing that occurs to me (in addition to my last message). The
sample package I put up for download doesn't contain any image stripper
configuration settings. In the deployment wizard you need to choose the
AXDllImageStripper and AXDllSessionManager. All other settings can be left
as defaults, with the exception of the "Strip class GUIDs" at Step 5, which
must be turned off because of the way I implemented the #clsid method - I
chose to do it like this:

SampleWordAddIn>>clsid
    ^self guid

rather than this:

SampleWordAddIn>>clsid
    ^CLSID fromString: '{000xxxetc etc}'

The standard image stripper configuration removes the class GUIDs, which
means that the CLSID of the add-in COM object will be null. This will
prevent it from being registered and instantiated.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Keith  Lander-2
Hi Blair

It's working OK now. The reason the stripped version didn't work was because
of the GUID problem you mentioned. I had tried and failed to get my version
to work because, I suspect, I'd tried cobbling together a type library using
IDTExtensibility2. I had managed to create the Addin registry entries for
Word, but I kept getting automation errors when it tried to connect. I even
tried creating a VB wrapper and using the VB bit to interface with Word, but
I still got problems wihen VB tried to talk to my stuff. I have looked at
your version, but don't fully understand it. The call to
registerClassFactory, which I never made, probably has something to do with
it!  This tells me I need to get a COM book and try to understand it all.
What book would you recommend - there are loads of them out there, most
probably pretty bad.

Many thanks
Keith

"Blair McGlashan" <[hidden email]> wrote in message
news:bc9ggi$glt1k$[hidden email]...

> "Keith Lander" <[hidden email]> wrote in message
> news:bc829s$shg$[hidden email]...
> > Hi Blair
> >
> > I've tried building the add-in DLL and ended up with the same problem
> (same
> > effect actually, maybe a different problem). When I go to the Com Add-in
> > command in word and try to add the DLL Word just ignores it - no error,
> and
> > no entry in the add-in list.
> >
> > Any ideas?
>
> One other thing that occurs to me (in addition to my last message). The
> sample package I put up for download doesn't contain any image stripper
> configuration settings. In the deployment wizard you need to choose the
> AXDllImageStripper and AXDllSessionManager. All other settings can be left
> as defaults, with the exception of the "Strip class GUIDs" at Step 5,
which

> must be turned off because of the way I implemented the #clsid method - I
> chose to do it like this:
>
> SampleWordAddIn>>clsid
>     ^self guid
>
> rather than this:
>
> SampleWordAddIn>>clsid
>     ^CLSID fromString: '{000xxxetc etc}'
>
> The standard image stripper configuration removes the class GUIDs, which
> means that the CLSID of the add-in COM object will be null. This will
> prevent it from being registered and instantiated.
>
> Regards
>
> Blair
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Keith  Lander-2
In reply to this post by Blair McGlashan
Blair

Another problem I had when trying to do this was working out how to
implement a menu item (CommandBarButton) in word. In VB you pass in the
Progid of the Addin as a property of the button and declare an event
(WithEvents) variable for the button. How do you do the same in DST?

Cheers
Keith

"Blair McGlashan" <[hidden email]> wrote in message
news:bc9ggi$glt1k$[hidden email]...

> "Keith Lander" <[hidden email]> wrote in message
> news:bc829s$shg$[hidden email]...
> > Hi Blair
> >
> > I've tried building the add-in DLL and ended up with the same problem
> (same
> > effect actually, maybe a different problem). When I go to the Com Add-in
> > command in word and try to add the DLL Word just ignores it - no error,
> and
> > no entry in the add-in list.
> >
> > Any ideas?
>
> One other thing that occurs to me (in addition to my last message). The
> sample package I put up for download doesn't contain any image stripper
> configuration settings. In the deployment wizard you need to choose the
> AXDllImageStripper and AXDllSessionManager. All other settings can be left
> as defaults, with the exception of the "Strip class GUIDs" at Step 5,
which

> must be turned off because of the way I implemented the #clsid method - I
> chose to do it like this:
>
> SampleWordAddIn>>clsid
>     ^self guid
>
> rather than this:
>
> SampleWordAddIn>>clsid
>     ^CLSID fromString: '{000xxxetc etc}'
>
> The standard image stripper configuration removes the class GUIDs, which
> means that the CLSID of the add-in COM object will be null. This will
> prevent it from being registered and instantiated.
>
> Regards
>
> Blair
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Blair McGlashan-2
Keith

You wrote in message news:bc9sra$vrr$[hidden email]...
> Blair
>
> Another problem I had when trying to do this was working out how to
> implement a menu item (CommandBarButton) in word. In VB you pass in the
> Progid of the Addin as a property of the button and declare an event
> (WithEvents) variable for the button. How do you do the same in DST?

The AXEventSink class can be used to connect to any thing that publishes
events through the standard COM connection points mechanism (which is what
WithEvents is hooking into). To connect an event sink you need to do
something like this:

    unk := <interface onto the object you are connecting to events from, in
this case the CommandBarButton>.
    "Get ITypeInfo describing the object's default event (source) interface"

    tiSink := unk coclassTypeInfo defaultSourceInterface.

    sink := AXEventSink target: self sourceTypeInfo: tiSink.
    sink connect.

When events are received via the event sink these are translated to
Smalltalk events triggered off the "target" (in this case 'self', whatever
that is). You can turn on a debug trace of these events by sending the
AXEventSink an #isTracingEvents: message with true as the argument. The
event names will be constructed from the type information, you can list them
all by sending the AXEventSink a #eventNames message.

You should hold onto the AXEventSink in an instance variable of something
with the right lifetime, and then when finished with it disconnect it with
the #disconnect message.

You

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Scott D
In reply to this post by Blair McGlashan
Any chance of still getting the SampleWordAddIn.zip file.  The link
does not work for me.

Thanks,
Scott

Blair McGlashan wrote:
> "Blair McGlashan" <[hidden email]> wrote in message
> news:bc4rcc$ffa57$[hidden email]...
> >
> > I've put together a sample that illustrates the basic requirements
to have
> a
> > Dolphin COM add-in be recognised by MSWord. You can download it
from:

Reply | Threaded
Open this post in threaded view
|

Re: Implementing an MS Office COM Add-in using DST

Andy Bower-3
Scott,

> Any chance of still getting the SampleWordAddIn.zip file.  The link
> does not work for me.

Sorry, it's now been moved to:

http://www.object-arts.com/downloads/samples/SampleWordAddIn.zip

Best regards

Andy Bower
Dolphin Support
www.object-arts.com