Adding image to Outlook commandbar button

S

saturn

I am writing a VC++ application where I have to add a commandbar and a
button to commandbar on any new inspector window. I have successfully
added the commandbar and button to my commandbar. I have done these in
a handler of New Inspector.

Now I am stuck with following issues:
1. I have to add an image to my button added to the commandbar. How
can I do this in VC++?
2. How do I register a handler for my button click?
3. Is there any property of commandbar through which I can uniquely
identify it? This will help in making decision of adding commandbar if
already not present.

Any pointers on these will be very helpful.

Regards,
Pradeep
 
K

Ken Slovak - [MVP - Outlook]

Please do not multipost. I answered your question in
developer.outlook.addins.
 
S

saturn

Now I am able to trap the click of my button. But the callback
function receives CommandBarButton. Using this how I can identify the
inspector on which the button was clicked? How suitable is to conside
the active window?

Regards,
Pradeep
 
K

Ken Slovak - [MVP - Outlook]

ActiveInspector usually works, but not always.

The best practice is to construct a unique Tag property for each button you
create. I usually use a GUID or unique string value with a Key value
assigned to each open Inspector. The key value gets incremented each time an
Inspector is opened. That key is stored in a public property in the
Inspector wrapper class so it's accessible. I make up the tag value with the
GUID and key, then when a Click occurs it will only occur in that wrapper
class in the Click event handler inside that class.

If you don't use a unique Tag then Click will fire in every single open
Inspector, so if you're handling Click in one place and there are 3 open
Inspectors then you'll get 3 click events firing. Using Inspector wrappers
is another best practice, as is using Explorer wrappers to handle open
Explorers.
 

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