> I don't use C++ but I regularly add UI to WordMail items in Outlook 2003.
> There are some restrictions on where you can add UI, but it works as long as
[quoted text clipped - 11 lines]
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
I just skimmed that article but I saw a couple of things I wouldn't agree
with. For example he assumes that Tools is the 6th item in the Menu Bar
CommandBar. That's not always the case, some other code could have added a
control before Tools, shifting its index. You can't just assume positioning
like that and expect it to work on anything other than a virgin
installation. I also don't like using ActiveMenuBar, at least without
further testing, I've seen lots of problems with that approach.
You definitely need to handle NewInspector(), but the Inspector object
reference passed to you in NewInspector() is what's known as a weak object
reference. That means it doesn't necessarily have all the expected
properties available at that time. One of those properties that's often
missing or not fully initialized yet is Inspector.CommandBars. The only
properties you really should use in NewInspector() are some of the
properties of Inspector.CurrentItem, such as .Class and .MessageClass, used
to decide if you want to handle that Inspector.
Once the first Inspector.Activate() event fires you do have a fully
instantiated Inspector and then you can always retrieve the CommandBars
collection. One reason something like Inspector.CommandBars may not be
available to you in NewInspector() is that the event fires after the
Inspector is created but before its visible. WordMail takes extra time to
become fully available compared to an Outlook editor item, all the item data
must be passed to the subclassed msword.exe in Outlook 2003 and that takes
extra time.

Signature
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
Hi, Slovak
Thanks for the info, I based on my code on
http://www.codeproject.com/KB/COM/outlookaddin.aspx,
if you check the update on April 02,2003, you can see Amit Dey
recommend handling the new inspector event, is he wrong or is this
problem specific to OL2003?
Thanks
Jim
Jim - 22 Dec 2007 14:31 GMT
Hi, Slovak
Thanks for your evaluation of the code, I'm working on an approach
based on your suggestion. I took a look at the sample codes on your
website, do you mind if I use them as a guide? I'm looking at the
inspector wrapper code at http://www.slovaktech.com/code_samples.htm#InspectorWrapper:
It has some code on create menus and tries to use different method if
Word is used as editor. However, it doesn't seem to handle the
activate event, and although it checks if Word is used by setting
m_blnWord, but this is never used elsewhere in the code. Also the
CreateMenus method only creates the menu but didn't seem to attache
the menu to the command bar. I wonder if there's a more complete
sample of the inspector wrapper?
Thanks
Jim
> I just skimmed that article but I saw a couple of things I wouldn't agree
> with. For example he assumes that Tools is the 6th item in the Menu Bar
[quoted text clipped - 41 lines]
>
> Jim
Ken Slovak - [MVP - Outlook] - 22 Dec 2007 20:35 GMT
That's a shell of an Inspector wrapper, it doesn't do any of the heavy
lifting of actually doing anything useful with the menu (or even create it
for WordMail), and work best the way it creates UI with the Outlook editor
and earlier versions of Outlook 2003 and earlier.
Things changed later on, that sample really needs updating and filling in
for more recent best practices. When I put that sample online it was the
first Inspector wrapper sample available.
You can use any of my samples as a basis for your code.

Signature
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
> Hi, Slovak
>
[quoted text clipped - 14 lines]
>
> Jim