Re: COM Addin cannot access the CommandBars collections

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: George Sugari (george.sugari_at_eloqua.com)
Date: 06/17/04


Date: Thu, 17 Jun 2004 10:58:52 -0400

Dmitry,
I think what Michael is trying to say is that the Activate event does not
fire when you first open Outlook

George

"Dmitry Streblechenko (MVP)" <dmitry@dimastr.com> wrote in message
news:OrV2%23qxUEHA.3540@TK2MSFTNGP11.phx.gbl...
> Why do you need the second Activate event? Add the toolbars/buttons as
soon
> as the first Activate fires.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Michael Hoehne" <MichaelHoehne@discussions.microsoft.com> wrote in
message
> news:344367E1-885A-4006-998D-98267F70B4AE@microsoft.com...
> > Well, thanks for your answer. But it doesn't work after the first
Activate
> event as well. Only if I switch do another application to deactivate
Outlook
> and then switch back to the Explorer again, another Activate is fired. At
> this time the menu initialization works fine.
> >
> > As a workaround I create a timer when receiving the first Activate event
> that fires every 2 seconds until a "valid" Explorer object is present,
> meaning that I can do the menu customization.
> >
> > Thanks for your help, I appreciate it.
> >
> > Michael
> >
> >
> > "Dmitry Streblechenko (MVP)" wrote:
> >
> > > At the time NewExplorer event fires, the explorer has not yet been
fully
> > > initialized. Wait for the Explorer.Activate event and add your
> > > toolbars/buttons in that event handler if they are not already there.
> > >
> > > Dmitry Streblechenko (MVP)
> > > http://www.dimastr.com/
> > > OutlookSpy - Outlook, CDO
> > > and MAPI Developer Tool
> > >
> > >
> > > "Michael Hoehne" <Michael Hoehne@discussions.microsoft.com> wrote in
> message
> > > news:934EBFE1-146E-4A94-BF45-B352165626F6@microsoft.com...
> > > > I have a very strange situation here and hope that someone can
confirm
> > > this behaviour or provide a solution.
> > > >
> > > > My addin works fine as long as I start Outlook in the usual way,
> meaning
> > > clicking the Outlook Icon and launching the full application. In this
> > > scenario I can modify the ActiveExplorer's command bar (menu items,
> > > toolbars, etc.)
> > > >
> > > > Now, when I first open a .msg file from the filesystem, Outlook
starts
> and
> > > the addin is loaded. However at this time there's no active explorer,
> what
> > > is expected, because the only visible thing on the screen is an
> inspector
> > > object.
> > > >
> > > > To create the menu entries (and of course the associated event
> handlers),
> > > I hook into the NewExplorer event of the Application.Explorers
> collection
> > > and do receive the event when Outlook is launched. The newly created
> > > Explorer object is passed to the event routine and I expected that I
can
> > > simply add my menus to its CommandBars collection. BUT: any call to
> > > explorer.CommandBars throws an error with some useless text (error
> executing
> > > the operation).
> > > >
> > > > Does anyone have a solution for this or can anyone confirm this to
be
> a
> > > bug in Outlook?
> > > >
> > > > Thanks
> > > > Michael
> > >
> > >
> > >
>
>


Quantcast