sticky buttons to secondary outlook windows

S

Stephan Steiner

Hi

I'm progressing with my Outlook add-in but I've run into another roadblock:
The buttons I add to the main window menubar are sticky.. if though I delete
the button(s) in OnBeginShotdown, the next time I start up Outlook, the
button is still there and does not have to be registered again.

However, when I add buttons to a contact (incidentally I create my own
Commandbar for that since I can't figure out how to add new buttons to the
standard commandbar of the contact window), those are non sticky and have to
be re-added each time a contact is opened (I'm stepping through the program
so I see how they are re-created). How can I make those buttons sticky so
that they don't have to be re-added each time?

And while we're at it, how can I pass the proper contact to the event
listener that catches when I press on one of the buttons in the contact? The
method processing the button clicks needs to know which contact window
triggered the event, as it has to process certain data from that contact.

Any help would be appreciated
Stephan
 
K

Ken Slovak - [MVP - Outlook]

Always use Temporary = True when you create any buttons and toolbars and
then create them on the fly as needed. Leaving buttons around is asking for
trouble later on.

I add buttons to a menu in different ways depending on what I want. A new
menu in CommandBars("Menu Bar") is added by getting the Controls collection
of the CommandBar then adding a CommandBarPopup control. For adding anything
you would use the Add method of the Controls collection.

For handling events in Inspectors, where you can have more than one open you
will need an Inspector wrapper class and collection with the buttons added
to each class member when a class is added to the collection when
NewInspector fires. See the VB 6 Inspector wrapper skeleton I posted in the
"catch events in c#" thread.

To make a button uniquely handle Click events in only that one Inspector you
need to generate a unique Button.Tag property for each button you add.
Otherwise every button with that Tag will fire its Click event when any
button is clicked.

-
 

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