S
ssissa
Hi,
I am building a plugin for Word, and am experiencing many problems when the
user opens a Word document in Internet Explorer. For example, (1) setting the
visibility and position a toolbar seems to have no effect, I suppose because
IE is doing something above me to turn off all the toolbars; (2) some
functions result in a COM exception, particularly the Documents.Add() and
"The X method or property is not available because this document is in
another application"; and (3) some events that normally fire, such as
Application.DocumentChange, do not.
It may be natural for my plugin to behave differently when in such a
"hosted" mode, but I am not sure how I can correctly detect such a mode.
I have previously used the "custom" property passed to
IDTExtensibility2.OnConnection. Checking that custom[1] == 1 seems to be a
good test as to whether Word was loaded through automation or not. The
problem is that there are cases where word is loaded through automation but
my plugin can behave normally. In particular, if I first open a Word document
in IE, then I manually launch a new instance of Word, I seem to be in the
same process and same IDTExtensibility2.OnConnection scope. If I don't load
my plugin when custom[1] == 1, then it won't be available in the subsuquent
new instances. Even if I do load it, my toolbar does not even show in the new
instance (was it was set invisible in the IE instance?). I suppose I need
some way to know that the first window was "hosted" and the new is normal so
my plugin can behave appropriatly in each window.
Is there some per-document or per-window way to know if the document/window
is hosted? Is this something special in the context of IE, or can I expect
other "hosted" environments when building my plugin?
Similar answers in the context of PowerPoint and/or Excel can also be helpful.
Thanks,
Bret
I am building a plugin for Word, and am experiencing many problems when the
user opens a Word document in Internet Explorer. For example, (1) setting the
visibility and position a toolbar seems to have no effect, I suppose because
IE is doing something above me to turn off all the toolbars; (2) some
functions result in a COM exception, particularly the Documents.Add() and
"The X method or property is not available because this document is in
another application"; and (3) some events that normally fire, such as
Application.DocumentChange, do not.
It may be natural for my plugin to behave differently when in such a
"hosted" mode, but I am not sure how I can correctly detect such a mode.
I have previously used the "custom" property passed to
IDTExtensibility2.OnConnection. Checking that custom[1] == 1 seems to be a
good test as to whether Word was loaded through automation or not. The
problem is that there are cases where word is loaded through automation but
my plugin can behave normally. In particular, if I first open a Word document
in IE, then I manually launch a new instance of Word, I seem to be in the
same process and same IDTExtensibility2.OnConnection scope. If I don't load
my plugin when custom[1] == 1, then it won't be available in the subsuquent
new instances. Even if I do load it, my toolbar does not even show in the new
instance (was it was set invisible in the IE instance?). I suppose I need
some way to know that the first window was "hosted" and the new is normal so
my plugin can behave appropriatly in each window.
Is there some per-document or per-window way to know if the document/window
is hosted? Is this something special in the context of IE, or can I expect
other "hosted" environments when building my plugin?
Similar answers in the context of PowerPoint and/or Excel can also be helpful.
Thanks,
Bret