D
David Thielen
Hello;
I've written about this twice before but now I just found another problem
with this. First off, the is a C# add-in under Word 2003 and my menu objects
are in global scope and therefore are not garbage collected.
In addition, if I start Word and bring up a document, it works 100%.
Problem 1 - under very repeatable conditions, I can get to a point where
setting CommandBarControl.Enabled, which previously worked fine, will
generate an exception. To work around this, I catch the exception and at that
time reassign that menu item to my object. I did not grab the menu event
again as that kept firing ok.
Problem 2 - When I first had this happen, I tried reassigning the menu
object on the Application.DocumentChange event as the exception would always
occur inside my handler for that event (thereby avoiding an exception).
However, when I did that, I would then lose my menu events. So this can only
be done when the exception is thrown.
Problem 3 - this is the one I can't work around - today I found that
sometimes when I reassing the menu objects, I then lose the menu events (ie
Problem 2). I have not been able to come up with a specific sequence to
reproduce it but I am 100% certain the events stopped firing.
Here's the problem. I can't always grab the menu events again when the
exception is thrown because usually I am still getting them and by doing this
I would get multiple events for a single menu click.
But I need to know when I will lose the events so in that case I can get the
event again.
Or better yet, a work around that avoids this bug altogether where my menu
objects are always pointing to the underlying COM menus.
Again, none of this happens if you open a single copy of Word and edit
documents in that one copy. It's multiple copies and documents being closed
in some that causes this. So it's quite possible that Microsoft's testing has
never hit these combinations (although I would hope so as it is pretty simple
use).
Any ideas?
I've written about this twice before but now I just found another problem
with this. First off, the is a C# add-in under Word 2003 and my menu objects
are in global scope and therefore are not garbage collected.
In addition, if I start Word and bring up a document, it works 100%.
Problem 1 - under very repeatable conditions, I can get to a point where
setting CommandBarControl.Enabled, which previously worked fine, will
generate an exception. To work around this, I catch the exception and at that
time reassign that menu item to my object. I did not grab the menu event
again as that kept firing ok.
Problem 2 - When I first had this happen, I tried reassigning the menu
object on the Application.DocumentChange event as the exception would always
occur inside my handler for that event (thereby avoiding an exception).
However, when I did that, I would then lose my menu events. So this can only
be done when the exception is thrown.
Problem 3 - this is the one I can't work around - today I found that
sometimes when I reassing the menu objects, I then lose the menu events (ie
Problem 2). I have not been able to come up with a specific sequence to
reproduce it but I am 100% certain the events stopped firing.
Here's the problem. I can't always grab the menu events again when the
exception is thrown because usually I am still getting them and by doing this
I would get multiple events for a single menu click.
But I need to know when I will lose the events so in that case I can get the
event again.
Or better yet, a work around that avoids this bug altogether where my menu
objects are always pointing to the underlying COM menus.
Again, none of this happens if you open a single copy of Word and edit
documents in that one copy. It's multiple copies and documents being closed
in some that causes this. So it's quite possible that Microsoft's testing has
never hit these combinations (although I would hope so as it is pretty simple
use).
Any ideas?