Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
developer
active.documents
automation
binary.file_format
clipboard.dde
com.add_ins
hosting.controls
internet_other
office.sdks
officedev
officedev.other
outlook.forms
outlook.vba
smarttags
vba
web.components
  
 
date: Tue, 22 Jul 2008 05:18:14 +0200,    group: microsoft.public.office.developer.com.add_ins        back       


IRibbonExtensibility integration issue for unmanaged AddIn   
Hello,

i am trying to integrate support for Outlook 2007s Ribbon interface in an otherwise already working AddIn using C++/ATL.
After quite some reading around however i still haven't come to the Point where IRibbonExtensibility::GetCustomUI() is actually called.
The main addin class looks like this:

class ATL_NO_VTABLE CAddin :
  ...
  public IDispatchImpl<IRibbonExtensibility, &__uuidof(IRibbonExtensibility), &LIBID_Office, 2, 4>
{
  ...
  BEGIN_COM_MAP(CAddin)
    ...
    COM_INTERFACE_ENTRY(IRibbonExtensibility)
  END_COM_MAP()
  ...
  STDMETHOD(GetCustomUI)(BSTR RibbonID, BSTR * RibbonXml)
  {
    MessageBox(NULL, "CAddin::GetCustomUI()", "", MB_OK);
    return E_NOTIMPL;
  };
  ...
};
OBJECT_ENTRY_AUTO(__uuidof(Addin), CAddin)

As already mentioned, GetCustomUI() never even gets hit - and i am rather clueless now. 
Am i supposed to add additional interface entries to the addins main idl file?
If so, what exactly? My websearch and trial and error didn't give me any working results yet.
Any suggestions are appreciated.

Thanks
date: Tue, 22 Jul 2008 05:18:14 +0200   author:   gf

Re: IRibbonExtensibility integration issue for unmanaged AddIn   
I don't do C++ so I can't help with the exact code you need but the rule is 
that whatever class is handling the interfaces for IDTExtensibilty is the 
class that needs to handle the interfaces for IRibbonExtensibility. Are you 
doing that?

-- 
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"gf"  wrote in message 
news:eGWMXn66IHA.4468@TK2MSFTNGP02.phx.gbl...
> Hello,
>
> i am trying to integrate support for Outlook 2007s Ribbon interface in an 
> otherwise already working AddIn using C++/ATL.
> After quite some reading around however i still haven't come to the Point 
> where IRibbonExtensibility::GetCustomUI() is actually called.
> The main addin class looks like this:
>
> class ATL_NO_VTABLE CAddin :
>  ...
>  public IDispatchImpl<IRibbonExtensibility, 
> &__uuidof(IRibbonExtensibility), &LIBID_Office, 2, 4>
> {
>  ...
>  BEGIN_COM_MAP(CAddin)
>    ...
>    COM_INTERFACE_ENTRY(IRibbonExtensibility)
>  END_COM_MAP()
>  ...
>  STDMETHOD(GetCustomUI)(BSTR RibbonID, BSTR * RibbonXml)
>  {
>    MessageBox(NULL, "CAddin::GetCustomUI()", "", MB_OK);
>    return E_NOTIMPL;
>  };
>  ...
> };
> OBJECT_ENTRY_AUTO(__uuidof(Addin), CAddin)
>
> As already mentioned, GetCustomUI() never even gets hit - and i am rather 
> clueless now.
> Am i supposed to add additional interface entries to the addins main idl 
> file?
> If so, what exactly? My websearch and trial and error didn't give me any 
> working results yet.
> Any suggestions are appreciated.
>
> Thanks
date: Tue, 22 Jul 2008 08:55:56 -0400   author:   Ken Slovak - [MVP - Outlook]

Re: IRibbonExtensibility integration issue for unmanaged AddIn   
This looks OK to me and I don't know why your GetCustomUI is not being 
called.  I did the same thing based on this sample:

http://blogs.msdn.com/jensenh/archive/2006/12/08/using-ribbonx-with-c-and-atl.aspx

and it is working just fine for me (in C++/ATL).  The sample at that link 
also establishes a callback interface to receive ribbon control 
notifications, and that interface must be in your IDL and it must be 
registered.  With VS2005 I found it necessary to hand craft an .rgs file to 
get the interface registered.  I wouldn't think that's relevant to getting 
the GetCustomUI call, but maybe if you don't register the callback interface 
the ribbon ignores you(?)


"gf"  wrote in message 
news:eGWMXn66IHA.4468@TK2MSFTNGP02.phx.gbl...
> Hello,
>
> i am trying to integrate support for Outlook 2007s Ribbon interface in an 
> otherwise already working AddIn using C++/ATL.
> After quite some reading around however i still haven't come to the Point 
> where IRibbonExtensibility::GetCustomUI() is actually called.
> The main addin class looks like this:
>
> class ATL_NO_VTABLE CAddin :
>  ...
>  public IDispatchImpl<IRibbonExtensibility, 
> &__uuidof(IRibbonExtensibility), &LIBID_Office, 2, 4>
> {
>  ...
>  BEGIN_COM_MAP(CAddin)
>    ...
>    COM_INTERFACE_ENTRY(IRibbonExtensibility)
>  END_COM_MAP()
>  ...
>  STDMETHOD(GetCustomUI)(BSTR RibbonID, BSTR * RibbonXml)
>  {
>    MessageBox(NULL, "CAddin::GetCustomUI()", "", MB_OK);
>    return E_NOTIMPL;
>  };
>  ...
> };
> OBJECT_ENTRY_AUTO(__uuidof(Addin), CAddin)
>
> As already mentioned, GetCustomUI() never even gets hit - and i am rather 
> clueless now.
> Am i supposed to add additional interface entries to the addins main idl 
> file?
> If so, what exactly? My websearch and trial and error didn't give me any 
> working results yet.
> Any suggestions are appreciated.
>
> Thanks

-- 
Scott McPhillips [VC++ MVP]
date: Tue, 22 Jul 2008 10:24:16 -0400   author:   Scott McPhillips [MVP] org-dot-mvps-at-scottmcp

Re: IRibbonExtensibility integration issue for unmanaged AddIn   
Sadly it did work at first, but now for some reason the Callback Interface isn't accessed anymore at all.
As there are no error messages for onAction as well as loadImage methods i guess Outlook doesn't even call the callback interfaces Invoke-implementation.
After more then a day of trying different things i am again out of clues.
Only thing i can imagine is that Outlooks QueryInterface for IDispatch does not return the ICallBackInterface - but that should be taken care of by COM_INTERFACE_ENTRY2().

The Ole/COM-Object Viewer shows everything seems to be fine, wether i view the dlls typelib directly or the registered typelib.
Also the not Ribbon-Specific code and IRibbonExtensibility still work fine.

Any hints would be appreciated.

The simplified relevant source and IDL (taken from the Object Viewer):

class ATL_NO_VTABLE CAddin : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CAddin, &CLSID_Addin>,
	public IDispatchImpl<IDTExtensibility2, &IID__IDTExtensibility2, &LIBID_AddInDesignerObjects, 1, 0>,
	public IDispatchImpl<IRibbonExtensibility, &__uuidof(IRibbonExtensibility), &LIBID_Office , /* wMajor = */ 2, /* wMinor = */ 4>,
	public IDispatchImpl<ICallbackInterface, &__uuidof(ICallbackInterface), &LIBID_OUTLOOKADDINLib, /* wMajor = */ 1, /* wMinor = */ 0>,
	[... IDispEventSimpleImpl<>s ...]
{
  [...]
  BEGIN_COM_MAP(CAddin)
    COM_INTERFACE_ENTRY2(IDispatch, ICallbackInterface)
    COM_INTERFACE_ENTRY(IDTExtensibility2)
    COM_INTERFACE_ENTRY(IRibbonExtensibility)
    COM_INTERFACE_ENTRY(ICallbackInterface)
  END_COM_MAP()
  [...]
};
OBJECT_ENTRY_AUTO(__uuidof(Addin), CAddin)



[
  uuid(...), version(1.0),
  helpstring("Outlook Addin 1.0 library")
]
library OUTLOOKADDINLib
{
  importlib("stdole2.tlb");

  interface ICallbackInterface;

  [
    uuid(...),
    helpstring("Addin Class")
  ]
  coclass Addin {
    [default] interface IUnknown;
  };
  [
    uuid(...),
    helpstring("CallbackInterface Class")
  ]
  coclass CallbackInterface { // most probably not needed
    [default] interface ICallbackInterface;
  };
  [
    odl, uuid(...),
    helpstring("ICallbackInterface Interface"),
    dual, nonextensible, oleautomation
  ]
  interface ICallbackInterface : IDispatch {
    [id(0x00000001), helpstring("method ButtonClicked")]
    HRESULT ButtonClicked([in] IDispatch* RibbonControl);
  };

  [...]
};
date: Fri, 25 Jul 2008 03:25:08 +0200   author:   gf

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us