Connect to Word COMAddin from another process...

N

nectar

Hello;

I've create a COMAddin that I would like to access from another process. I
can access the addin from VBA using:
Set x = Application.COMAddIns.Item("XX.Connect").Object

I'm trying to do the same thing in C# and C++"

From the application the creates Word, I've tried: (C#)
object caddin = app.COMAddIns.Item(ref oo).Object;
XX.IConnect c = caddin as XX.IConnect;
The above cast does not work...

From the application that creates Word, I've tried: (C++)
CComPtr <Office::COMAddIns> addins;
w_app->get_COMAddIns(&addins);
CComPtr <Office::COMAddIn> addin;
addin = addins->Item(&x);
XX::IConnect * p;
CComPtr <XX::IConnect> vr;
addin->get_Object((IDispatch**)&p);
I can connect to the object but the first method I call I get
Unhandled exception at 0x7713fde9 in WordCPP.exe: 0xC0000096:
Privileged instruction.

Can anyone help?
 
N

nectar

Hello;

I've create a COMAddin that I would like to access from another process. I
can access the addin from VBA using:
Set x = Application.COMAddIns.Item("XX.Connect").Object

I'm trying to do the same thing in C# and C++"

From the application the creates Word, I've tried: (C#)
object caddin = app.COMAddIns.Item(ref oo).Object;
XX.IConnect c = caddin as XX.IConnect;
The above cast does not work...

From the application that creates Word, I've tried: (C++)
CComPtr <Office::COMAddIns> addins;
w_app->get_COMAddIns(&addins);
CComPtr <Office::COMAddIn> addin;
addin = addins->Item(&x);
XX::IConnect * p;
CComPtr <XX::IConnect> vr;
addin->get_Object((IDispatch**)&p);
I can connect to the object but the first method I call I get
Unhandled exception at 0x7713fde9 in WordCPP.exe: 0xC0000096:
Privileged instruction.

Can anyone help?
 
F

Fredrik Wahlgren

Hello;

I've create a COMAddin that I would like to access from another process. I
can access the addin from VBA using:
Set x = Application.COMAddIns.Item("XX.Connect").Object

I'm trying to do the same thing in C# and C++"

From the application the creates Word, I've tried: (C#)
object caddin = app.COMAddIns.Item(ref oo).Object;
XX.IConnect c = caddin as XX.IConnect;
The above cast does not work...

From the application that creates Word, I've tried: (C++)
CComPtr <Office::COMAddIns> addins;
w_app->get_COMAddIns(&addins);
CComPtr <Office::COMAddIn> addin;
addin = addins->Item(&x);
XX::IConnect * p;
CComPtr <XX::IConnect> vr;
addin->get_Object((IDispatch**)&p);
I can connect to the object but the first method I call I get
Unhandled exception at 0x7713fde9 in WordCPP.exe: 0xC0000096:
Privileged instruction.

Can anyone help?

If i understand this correctly, I think you should create a reference to the
Word object and call whatever you want to access in your add-in from there.

/Fredrik
 
N

nectar

I have a reference to my Word object in my addin.
I want a reference to my addin in the process that created Word.

I'm surprised nobody from Microsoft has responded to this thread yet.

(e-mail address removed)
 

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