Hi,
I have an addin that manage file events (open, new, close, ...) and have some menu items and a toolbar.
Then each document of my solution have a VSTO customization that shows a Task Pane with a custom user control.
I want to share an instance of a object between the user control and the addin but i didn't find the way to communicate both pieces of code (addin and taskpane).
Anybody knows how I can access the instance of my addin from a VSTO dll
or
Anybody knows how I can access the TaskPane (document Actions) and then obtain the control list and access to the custom user control
Thanks in advance!
Juan

Addin - TaskPane communication
SSIS - newbie
Here i found the answer to the first question. http://support.microsoft.com/ kbid=240768
In the COM add-in, make sure to add the following line of code to the OnConnection subroutine of the add-in instance:
Application.COMAddIns.Item("MyOfficeAddin.Connect").Object = MeChange "MyOfficeAddin" to reflect the name of your add-in in the project. Change "Connect" to reflect the name of your designer in the project.
Your code may look like the following code:
Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) Application.COMAddIns.Item("MyAddin.Connect").Object = Me End SubRegards,
Juan
WienerSchnitzel
Hi Juan,
You can mark you Addin class e.g. "Connect" class with the [Serializable] attribute to get rid of the error.
The exception occurs when you try to read your Addin object in the VSTO customization. The reason for this error is that the .NET Addin object is executing in the Default Appdomain, but the VSTO customization is executing in a seperate Appdomain.
Even though you are reading the addin instance through Word's Com interfaces, the CLR is smart enough to realize that the object you are trying to get at, is in fact, a managed object masquerading as a COM object.
So, it tries to marshall the managed addin object from the default appdomain to the VSTO appdomain. This will fail because your addin object is neither serializable nor does it inherit from Marshall by ref.
More info about appdomains and marshalling: http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpguide/html/cpconapplicationdomains.asp
Hope this helps
elledibbi
I could not solve the problem with the code of the previous post.
When i try to access the Object property i get the following error: " MyAddin.Connect is not marked as serializable"
Anybody knows how can i solve thhis problem
Thanks in advance.
Juan