What you want to do is feasible. I don't do C++ addins, but here's how I'd
do it using C#. I'd set up one class that handles the extensibility
interface. I'd reference the Outlook 2000 object model. In my extensibility
class (or actually a partial instance of that class) I'd have the ribbon
declarations.
When I got OnConnection() I'd get the Outlook version. Based on that I'd
create user interface for Explorers and Inspectors using CommandBars where
appropriate, and just let the ribbon callbacks fire for that UI where it was
Outlook 2007 or 2010. For 2007 I'd create Explorer UI using CommandBars, for
2010 it would just be ribbon UI for Explorers.
For the ribbon declarations I'd have something like this:
//internal namespace to facilitate "Office" alias
space RibbonInterop
{
namespace Office
{
#region Ribbon
[ComImport(), Guid("000C0395-0000-0000-C000-000000000046"),
TypeLibType((short)0X1040)]
public interface IRibbonControl
{
[DispId(1)]
string Id { [return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
[DispId(2)]
object Context { [return: MarshalAs(UnmanagedType.IDispatch)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime), DispId(2)] get; }
[DispId(3)]
string Tag { [return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType = MethodCodeType.Runtime), DispId(3)] get; }
}
[ComImport(), Guid("000C0396-0000-0000-C000-000000000046"),
TypeLibType((short)0X1040)]
public interface IRibbonExtensibility
{
[return: MarshalAs(UnmanagedType.BStr)]
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(1)]
string GetCustomUI([In(), MarshalAs(UnmanagedType.BStr)] string RibbonID);
}
[ComImport(), Guid("000C03A7-0000-0000-C000-000000000046"),
TypeLibType((short)0X1040)]
public interface IRibbonUI
{
// for both Office 2007 and 2010
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(1)]
void Invalidate();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(2)]
void InvalidateControl([In(), MarshalAs(UnmanagedType.BStr)] string
ControlID);
// for Office 2010
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(3)]
void InvalidateControlMso([In(), MarshalAs(UnmanagedType.BStr)] string
ControlID);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(4)]
void ActivateTab([In(), MarshalAs(UnmanagedType.BStr)] string ControlID);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(5)]
void ActivateTabMso([In(), MarshalAs(UnmanagedType.BStr)] string ControlID);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType =
MethodCodeType.Runtime), DispId(6)]
void ActivateTabQ([In(), MarshalAs(UnmanagedType.BStr)] string ControlID,
[In(), MarshalAs(UnmanagedType.BStr)] string Namespace);
}
#endregion
}
}
"rakesh" <get.rakesh.sharma@gmail.com> wrote in message
news:%23DbDRykeKHA.1592@TK2MSFTNGP06.phx.gbl...
> Thanks Ken,
> I am using MS VC6 with ATL to build this COM plugin. Upto Outlook 2007, my
> plugin was looking great in Outlook's toolbar pane and in Outlook's menu.
> But in Outlook 2010 with ribbon technology, this toolbar looks very
> awkward. So I want to create a ribbon for my plugin in MS Outlook. And
> want to remove old toolbar from it.
> To create ribbon, I came to know that Windows 7 sdk is needed and mostly
> MS VS 2005/2008 c++ is used to develop them.
> I've created a sample ribbon button in Outlook with the help of other
> articles. But now I am confused, about my previous code.
> How can I merge both in one DLL?
> If one user has Outlook 2000 - 2007 and another has Outlook 2010, I want
> to support them using one DLL. Based on Outlook version I want to show
> the apropriate Toolbar to the user. Internal processing works fine for all
> versions. Difference is only in GUI.
> Is it feasible?
> Suggest me...
> _
>