How do add an Image(Icon) to a menu Button?

  • Thread starter Thread starter B
  • Start date Start date
B

B

I have created a COM addin in C++ that adds a couple of
menuButtons(CommandBarButton) to Microsoft Outlook. I have used
commandBarButton->put_Caption() to put the caption on to the button.
Now, I would like to know how exactly would I be able to add an icon or
image to this particular button. Code snippets would be of great help.

Thanks,
B.
 
If you put the image on the Clipboard you can use the PasteFace method of
the button to add the image if the button type is msoButtonIcon or
msoButtonIconAndCaption or one of the other types that supports icons. The
image should be 16x16x256 colors in BMP format to comply with the Office
button image guidelines.
 
Only if you want to use an image that's already used for an existing button.
To use a new image or your own image you have to use PasteFace.
 
You can also use CommandBarButton.Picture and Mask properties (Outlook 2002
and up) and set then to an instance of the IPicture COM object.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
True, but if you have to support Outlook 2000 and up that wouldn't work.
 
Back
Top