View Single Post
  #3  
Old June 14th 07, 11:05 PM posted to microsoft.public.outlook.program_addins
bstrum
external usenet poster
 
Posts: 19
Default Creating a command bar on an Inspector

Sorry, "dispid's" are the dispatch ids that are exposed via IDispatch. I was
able to hack it by trying various values:
0xf001= Activated
0xf006 = Deactivated
0xf008 = Closed

I am making some progress on what should really be a trivial task: creating
controls on a toolbar. I am still encountering problems and of course they
vary from office version. Any assistance / insight on this is greatly
appreciated.

Note: All of the problems are occuring within the Inspector-Activated
event. Also, all my code uses late binding.

In Office XP, I am not able to access Inspector.CommandBars. I get an
exception, "Exception has been thrown by the target of an invocation.".

In Office 2003, I am unable to set the Picture property of a newly created
CommandBarControl.
MO.CommandBarControls ctls = the controls of a newly created command bar
MO.CommandBarControl ctl = ctls["Options"];
System.Drawing.Image img = CommonImages.logo;
ctl.Picture = StdOleUtils.GettIPictureDispFromPicture(img); // throws
exception

In Office 2007, the above code throws an exception on the first activate
event but not afterwards.

Benjamin Strum
ThinkTron Corporation

"Ken Slovak - [MVP - Outlook]" wrote:

I don't think there's a difference in compatibility unless you're supporting
Outlook 2000.

I have no idea what you mean by the dispid's for those events, or why you
would need that.

Activate gets called many times. It may fire 2 or 3 times the first time the
item is activated, and then each time the focus returns to that item. Just
use a flag to test for the first Activate or to test for the UI having been
created. Since there are also cases where that first Activate will not fire
you usually back that up with a check in a handler for OnSelectionChange,
which will fire in those cases and there you also check for the UI creation.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"bstrum" wrote in message
...
Couple questions:

1) Should I use InspectorEvents or InspectorEvents_10? I.e., which one
ensures maximum compatiblity?

2) What are the dispids for Activate, Deactivate and Closed?

3) Does Activate get called multiple times for a specific mailitem?

Thank you,

Benjamin Strum
ThinkTron Corporation



Ads