From a high level perspective what we usually do is to create a class that
has the code to handle whatever Inspector and Inspector.CurrentItem events
we want to handle. Then as new Inspectors are opened and closed we use
NewInspector to instantiate instances of the Inspector handler class and add
them to a list or collection to keep them alive.
Then in the first Activate event of the new Inspector we instantiate the
CommandBar interfaces. In Outlook 2007 the Inspector.CommandBars collection
isn't there until that Activate fires.
When Inspector.Close fires we kill the object references in the class for
that Inspector and remove it from the list or collection.
When you create a new CommandBarButton object you give it a unique Tag
property value. I usually use a GUID plus a key value for the Inspector to
make a unique tag. The unique Tag prevents any Click events from the button
from firing in more than one instance of the Inspector handler class.
Check out
www.outlookcode.com for any Inspector handler class code samples.
As I recall, there might be a C++ example, certainly there are C# examples
there. I also have VS2005 templates for COM addins in C# on my Web site as
part of my book samples (no C++ examples though, sorry).
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
"Jayashree Sekar" wrote in message news:...
Message-ID:
X-Mailer: http://www.umailcampaign.com, ip log:61.247.251.29
Newsgroups: microsoft.public.outlook.program_addins
NNTP-Posting-Host: 22.bb.5446.static.theplanet.com 70.84.187.34
Path: TK2MSFTNGP01.phx.gbl!TK2MSFTNGP06.phx.gbl!newspe.c om
Lines: 1
Xref: TK2MSFTNGP01.phx.gbl microsoft.public.outlook.program_addins:29996
Hi Henry,
My requiremet is similar to Abdulla's. I need to include a custom toolbar
with some buttons in all inspectors which are of message class 'IPM.Post'.
I
use VC++ in my project.
First, I tried handling OnNewInspector event in which I tried inserting my
custom toolbar & advising the commandBar button event. This worked fine
for
the first inspector(i.e. when I click new MailMessage for the first time)
&
the problem raised when I tried opening another mail message. Technically
the problem was, I was not able to advise the commandBar button event for
the new inspector when it was already advised for the previous inspector.
After surfing the net, I read that my task can be very well accomplished
if
I handle the 'Activate' & 'DeActivate' events of 'InspectorEvents'.
But to handle this 'Activate' & 'DeActivate' events of 'InspectorEvents',
I
again have to advise them in 'OnNewInspector' which again gives me the
same
problem.
Please help me out. This a very urgent requirement & I have already spent
more time on exploring this.
Awaiting for your help,
Shree
url:http://www.ureader.com/msg/1079162.aspx