Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / June 2006

Tip: Looking for answers? Try searching our database.

explorer.activate event for installing commandbar on new explorers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick - 18 Jun 2006 23:38 GMT
Trying to set a commandbar when Outlook opens.  Several references have
suggested patching into the explorer.activate event, installing the
toolbar only on the first call to the event.

Those references are all somewhat dated, using earlier tools and
technologies.  I'm using VSTO 2005, and the activate event does not
seem to fire during the start sequence.  Perhaps it has already fired,
since there's already an activeexplorer in context (possibly implying
that it's already been "activated?")

I know my wiring is successful because my activate event trap will fire
if I minimize and restore the window, or if I switch to another app.  I
can even minimize and restore the explorer programatically to trigger
the activate event.  Is the activate event still a valid way to install
a commandbar?

Also, we use a third-party toolbar.  It always seems to load after my
toolbar.  Since it's not in context when I load, I can't access
RowIndex.  Is there a way to guarantee my button loads after the other
toolbar?
Ken Slovak - [MVP - Outlook] - 19 Jun 2006 16:33 GMT
There is no way at all to determine or control in what order addins are
loaded. You have to live with that uncertainty.

If Outlook is started with a UI (and Explorer) you first must hook the
ActiveExplorer object in the startup code so you handle events from that
Explorer. You can iterate the Explorers collection to verify that there is
at least 1 Explorer.

After that you hook any new Explorers using the Explorers collection
object's NewExplorer event.

Signature

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

> Trying to set a commandbar when Outlook opens.  Several references have
> suggested patching into the explorer.activate event, installing the
[quoted text clipped - 16 lines]
> RowIndex.  Is there a way to guarantee my button loads after the other
> toolbar?
Rick - 19 Jun 2006 19:06 GMT
Thanks, Ken.

When I examine ActiveExplorer(), I find that one does exist.  When I
tap into its .Activate event (using casting, since the event is
ambiguous with its .Activate() method), the event does not fire on
startup.  I know I'm wired in correctly since my eventhandler will fire
if I change focus to another application or minimize the window, and
then switch back to the explorer.  But to install my toolbar, I need an
event that fires automatically after the explorer loads.

I found a sample that uses SelectionChange to install toolbars, but it
seems to me that event is less efficient since it fires so often (and
since I only need to trap it the first time).  Is it a characteristic
of VSTO 2005 that .Activate no longer runs after startup, or that
startup takes place after .Activate runs???

> There is no way at all to determine or control in what order addins are
> loaded. You have to live with that uncertainty.
[quoted text clipped - 35 lines]
> > RowIndex.  Is there a way to guarantee my button loads after the other
> > toolbar?
Ken Slovak - [MVP - Outlook] - 20 Jun 2006 14:04 GMT
You will only get that first Activate event for Explorers added after
startup. So what you want to do is handle the first Activate for those and
something else for the initial Explorer. I usually just set things up when I
add the Explorer to an Explorers collection which lets me handle events from
any open Explorer discretely.

Some people use SelectionChange and set a Boolean flag that makes sure the
code runs only once, after that it just exits the event handler. You'd need
something like that for Activate as well, it fires every time the Explorer
is activated again (like after going back to Outlook from another
application).

You don't say what language you're using but if it's C# there's a nice
example of an Explorer wrapper that handles multiple Explorers at
http://www.outlookcode.com/codedetail.aspx?id=789. There's also a whole
section of VSTO code and information at
http://www.outlookcode.com/vsto/index.htm.

Signature

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

> Thanks, Ken.
>
[quoted text clipped - 11 lines]
> of VSTO 2005 that .Activate no longer runs after startup, or that
> startup takes place after .Activate runs???

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.