Re: COM Addin cannot access the CommandBars collections
From: Dmitry Streblechenko \(MVP\) (dmitry_at_dimastr.com)
Date: 06/17/04
- Next message: Kevin Foley: "Backup Plugin"
- Previous message: Dmitry Streblechenko \(MVP\): "Re: QI for IOleWindow fails in Outlook2003 office suite"
- In reply to: George Sugari: "Re: COM Addin cannot access the CommandBars collections"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 17 Jun 2004 11:25:47 -0700
Correct, it does not. In this case you should loop over all explorers in the
Application.Explorers collection on startup and try to add the toolbars. If
any of the calls fail, you can wait for the Activate event.
Works just fine for me.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"George Sugari" <george.sugari@eloqua.com> wrote in message
news:10d3cdf11es342d@corp.supernews.com...
> 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
> > > >
> > > >
> > > >
> >
> >
>
>
- Next message: Kevin Foley: "Backup Plugin"
- Previous message: Dmitry Streblechenko \(MVP\): "Re: QI for IOleWindow fails in Outlook2003 office suite"
- In reply to: George Sugari: "Re: COM Addin cannot access the CommandBars collections"
- Messages sorted by: [ date ] [ thread ]