RibbonX: Custom Image Callback Sample in VC++

D

Devansh

Hi there,
I am developing a COM outlook addin implementing IRibbonExtensibility
interface in VC++.

My question here is, how do I use "loadImage"/"getImage" tag? I could
not
find any sample code which I could use specially in VC++.

Do I need to include the callback corresponding to loadImage or
getImage also in IDL file with the other callback functions?
If no then how, what and where I am going to write it?
If yes then what I am going to write into it?

In one line my question is, How to attach a custom image to a button
created in Ribbon with VC++?

Kindly help me in this.

Thanks,
Devansh

PS: I am expecting a Sample Code in it.
 
K

Ken Slovak - [MVP - Outlook]

I don't do C++ so I can't be specific as to that language, but getImage is a
callback the same as getVisible or getEnabled are. You need to supply a
callback function for getImage that provides an IPictureDisp object as the
return value of the callback. For C# the callback signature would look like
this, assuming your XML line had getImage="GetRibbonImage":

public stdole.IPictureDisp GetRibbonImage(Office.IRibbonControl control)
{
// get the image as IPictureDisp, as an example iPic

return iPic;
}

The loadImage callback has a C# signature like this:

public Bitmap LoadImage(string imageName)
{
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("your project name
here" & imageName)
return new Bitmap(stream);
}

That is from the example at
http://msdn.microsoft.com/en-us/library/bb400925.aspx.

Maybe that will help you.
 

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