When multiple Inspectors (and Explorers) are open, or to handle that
situation you use a wrapper class and keep all wrapper class instances alive
in a collection of some sort (list, sorted list, hashtable, etc.). The
wrapper class has event handlers in it for the Inspector and item in the
Inspector, such as Activate() and Close(). It also exposes the Inspector and
CurrentItem as public properties available to the outside.
In a callback such as getImage() you would iterate the Inspectors wrapper
collection and get the Inspector exposed by each wrapper class instance,
then you compare that Inspector with what was passed in the callback.
Outlook 2007 makes that easy by allowing a direct comparison using == in c#
or Is in VB.NET.
When you find your Inspector you then can supply an image for it based on
the current setup and configuration.
I have some wrapper class examples on my Web site as part of the addin
sample templates there. I have templates for C#, VB.NET and VB6. You can
find them at
http://www.slovaktech.com/outlook_2007_templates.htm. There are
also other sample templates available at the outlookcode.com Web site.
"ryotyankou " <u48591@uwe> wrote in message
news:97f80880fb8c2@uwe...
> Thank you for the reply, Ken. I got the answers for my question. But
> that's
> not the end, i still have a question:
> How to change control image by code, in getImage callback? How about
> multiple
> inspector?
> As what i understand, we can call IRibbonUI::InvalidateControl("myctrlid")
> make the control initialize and get in callback function again, then set
> the
> image we wanted. But in multiple inspector, all control id are "myctrlid",
> if
> i call InvalidateControl, all inspector's getImage callback will fire, i
> don't know how to process it. I checked the IRibbonControl::GetContext,
> and
> compare it with active inspector, if equal, set the new image, if not,
> return
> old one, question is that how to know which is the old one, If i open 10
> inspector, should there be 9 old images? How to process? I'm quite
> confused.