Calling methods in a DLL that is also being loaded as COM Addin?

K

kewpcg

I have a template (Word or Excel - could be either) that has its own custom
toolbar that loads whenever the template loads. The template is in a Startup
or XLStart folder, so the toolbar is available at all times.

I also have an ActiveX DLL called Macros.dll, which I created using VB6. My
template has a reference set to Macros.dll.

Behind the template are one or more "stubs" that I have linked up to the
template's toolbar buttons. The stub procedures instantiate the Macros.dll
(if it is not already instantiated), and call a method exposed by that DLL's
interface.

Now, I decide to re-compile Macros.dll, making it into a COM Add-in. I need
to have this DLL perform some task when the app starts up, and due to various
loading and timing issues, I need this code to run in
AddinInstance_OnStartupComplete. So I added a COM Add-in designer
(connect.dsr) to this DLL and it is now loading in my app's COM Add-in
collection.

My question is, now that my DLL is loading as a COM Add-in, can I continue
to use the existing code behind the template that instantiate and call the
DLL and its methods? Am I creating a circular reference, or running two
separate instances of the object now that it is a COM Add-in?

Ideally, I would like to have the stubs reference the already-running COM
Add-in instance of the object. (I can get a reference to it from the Addins
collection, but none of my methods are accessible when I reference it in this
way.)

Any suggestions or caveats would be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top