We have a split Connect class that instantiates the addin kernel from another assembly. Our architectural project is to leave the user interface and business logic separate from the download module (= Connect class), but the limitations of the general Addin create problems.
what we did in Connect.cs:
[GuidAttribute("XYZ"), ProgId("XYZ")] public class Connect : Object, IDTExtensibility2, ICustomQueryInterface { ... CustomQueryInterfaceResult ICustomQueryInterface.GetInterface(ref Guid iid, out IntPtr ppv) { if (iid.Equals(new Guid("000C0396-0000-0000-C000-000000000046"))) { ppv = Marshal.GetComInterfaceForObject( UIObject, typeof(IRibbonExtensibility), CustomQueryInterfaceMode.Ignore); return CustomQueryInterfaceResult.Handled; } ppv = IntPtr.Zero; return CustomQueryInterfaceResult.NotHandled; } }
what RibbonUI looks like:
public interface IOfficeFluentUI : IRibbonExtensibility { ... } public class OfficeFluentUI : OfficeUIBase, IOfficeFluentUI { ... public string GetCustomUI(string RibbonID) { ... } }
The GetInterface function works, it receives the com interface, but, unfortunately, the GetCustomUI function does not call. What are we wrong? Thanks so much for any help.
[edit] We already know the " Managed COM Aggregation " and " ICustomQueryInterface " articles, unfortunately they really didn't help.
c # aggregation com shared-addin
sputnik
source share