S
Sunny
Hi,
I'm writing COM addin for Outlook 2000 in C#/VS.Net 2003
Now I know how hard is this, but as far as most of the work is already done
.... I have to finish it.
So, just now I found a new problem:
I can not cast Outlook.Application to Outlook.ApplicationClass using:
appClass = (Outlook.ApplicationClass)applicationObject;
The same thing works with Outlook.Explorer/ExplorerClass and
Inspector/InspectorClass.
The problem is, that some events (like Quit) exists only in
ApplicationClass, and not in Application.
Any workaround?
I tried to look in the .IL which is generated by ildasm, and can not see any
different between the Quit event and StartUp event, but the second one is in
..Application, and .Quit - not ?!?!?
Thanks in advance
Sunny
P.S. I need the Quit event as a last try to remove buttons I've created. If
I create buttons as temporary on a Explorer, they don't exist if user opens
a new explorer. And I can not create them in the NewExplorer event, because
there the Explorer is not fully created, and referencing to its commandbars
fails.
I have trapped the Activate event of the newly created explorer, but ...
strange, the temporary created buttons (created during the addin start) are
there in that moment, so there is no need to recreate them, and ... they
disappear just after I exit the event handler.
It seems that there is no other way, than to create the buttons as
permanent, and delete them on exit. So I have to keep a reference to every
explorer opened in order to catch it's Close event, and if I'm trying to
close the last one, to delete buttons. I don't want to do this (a lot of
coding, where something can go wrong, trying to guess which explorer is
closing, to release the reference, etc.), that's why I just decided to try
to capture the application.Quit event ... and there is the above problem.
If there are some ideas around (except that this is very exotic to create
such a thing in .net ) please, push me in the right direction.
Thanks again
SUnny
I'm writing COM addin for Outlook 2000 in C#/VS.Net 2003
Now I know how hard is this, but as far as most of the work is already done
.... I have to finish it.
So, just now I found a new problem:
I can not cast Outlook.Application to Outlook.ApplicationClass using:
appClass = (Outlook.ApplicationClass)applicationObject;
The same thing works with Outlook.Explorer/ExplorerClass and
Inspector/InspectorClass.
The problem is, that some events (like Quit) exists only in
ApplicationClass, and not in Application.
Any workaround?
I tried to look in the .IL which is generated by ildasm, and can not see any
different between the Quit event and StartUp event, but the second one is in
..Application, and .Quit - not ?!?!?
Thanks in advance
Sunny
P.S. I need the Quit event as a last try to remove buttons I've created. If
I create buttons as temporary on a Explorer, they don't exist if user opens
a new explorer. And I can not create them in the NewExplorer event, because
there the Explorer is not fully created, and referencing to its commandbars
fails.
I have trapped the Activate event of the newly created explorer, but ...
strange, the temporary created buttons (created during the addin start) are
there in that moment, so there is no need to recreate them, and ... they
disappear just after I exit the event handler.
It seems that there is no other way, than to create the buttons as
permanent, and delete them on exit. So I have to keep a reference to every
explorer opened in order to catch it's Close event, and if I'm trying to
close the last one, to delete buttons. I don't want to do this (a lot of
coding, where something can go wrong, trying to guess which explorer is
closing, to release the reference, etc.), that's why I just decided to try
to capture the application.Quit event ... and there is the above problem.
If there are some ideas around (except that this is very exotic to create
such a thing in .net ) please, push me in the right direction.
Thanks again
SUnny