C
Chris Bardon
I've been working on an Outlook COM addin for a while now, and thanks
to the great post here (http://blogs.msdn.com/eric_carter/archive/
2004/10/10/240568.aspx) I've managed to implement a listener on the
event interface for explorer creation. The problem I'm still running
into though, is that the custom controls I create as temporary aren't
being created if Outlook is already loaded by another application in
the background (as a COM object).
My event listener looks for new explorer events, and then installs an
activation handler on the explorer. When the explorer is activated, I
create my controls. The problem here is that when I launched Outlook,
the explorer was created, but not activated right away (I'd have to
click out of Outlook, and then back to trigger the activation event).
My solution to this problem was to force the newly created explorer to
activate when I detected its creation, which works when Outlook is
launched normally, but if Outlook.exe is already running in the
background, it looks like a new explorer is created that can't be
activated right away (i.e. its associated application is null). I can
still install a handler on it, but my controls aren't installed until
the explorer is manually activated by switching applications from and
back to Outlook.
What I'm trying to figure out at this point is, can I force a new
explorer to be created as active? If the main Outlook GUI is the
Explorer object, then I can't figure out why it could be created and
not be active (or at least, activatable). Even if I continue with the
explorer object, attempting to access the command bars object on it
using:
oCommandBars =
(CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars",
BindingFlags.GetProperty, null, oActiveExplorer, null);
I get an exception. Why is it that an explorer is created without a
command bars object? Is there a better way to create temporary
controls on the command bars of an explorer rather than monitoring the
activation/creation events?
I'm kind of confused here, and I'd appreciate an assist on this one.
Thanks,
Chris
to the great post here (http://blogs.msdn.com/eric_carter/archive/
2004/10/10/240568.aspx) I've managed to implement a listener on the
event interface for explorer creation. The problem I'm still running
into though, is that the custom controls I create as temporary aren't
being created if Outlook is already loaded by another application in
the background (as a COM object).
My event listener looks for new explorer events, and then installs an
activation handler on the explorer. When the explorer is activated, I
create my controls. The problem here is that when I launched Outlook,
the explorer was created, but not activated right away (I'd have to
click out of Outlook, and then back to trigger the activation event).
My solution to this problem was to force the newly created explorer to
activate when I detected its creation, which works when Outlook is
launched normally, but if Outlook.exe is already running in the
background, it looks like a new explorer is created that can't be
activated right away (i.e. its associated application is null). I can
still install a handler on it, but my controls aren't installed until
the explorer is manually activated by switching applications from and
back to Outlook.
What I'm trying to figure out at this point is, can I force a new
explorer to be created as active? If the main Outlook GUI is the
Explorer object, then I can't figure out why it could be created and
not be active (or at least, activatable). Even if I continue with the
explorer object, attempting to access the command bars object on it
using:
oCommandBars =
(CommandBars)oActiveExplorer.GetType().InvokeMember("CommandBars",
BindingFlags.GetProperty, null, oActiveExplorer, null);
I get an exception. Why is it that an explorer is created without a
command bars object? Is there a better way to create temporary
controls on the command bars of an explorer rather than monitoring the
activation/creation events?
I'm kind of confused here, and I'd appreciate an assist on this one.
Thanks,
Chris