"Unadvising" Event Sink in VB6
-
I have COM object written in C# that exposes connection points and deployed as out of process server. I wrote VB6 application that supplies handler for the events fired by this COM object. To do that I added reference in my VB project to type library generated for C# COM. Next I used WithEvents statement in my VB code to declare variable of the events firing type exported from the COM. The application works fine. I can consume the events from the C# COM in my VB6 code. Problem arises when I stop my VB application. The delegate that implements the event in C# remains assigned and exception is thrown when attempt is made to call it. When you implement Event Sink say in C++ you use Advise – Unadvise paradigm to assign and clean up your handlers. What you supposed to do in VB6? Any help will be appreciated.
-
I have COM object written in C# that exposes connection points and deployed as out of process server. I wrote VB6 application that supplies handler for the events fired by this COM object. To do that I added reference in my VB project to type library generated for C# COM. Next I used WithEvents statement in my VB code to declare variable of the events firing type exported from the COM. The application works fine. I can consume the events from the C# COM in my VB6 code. Problem arises when I stop my VB application. The delegate that implements the event in C# remains assigned and exception is thrown when attempt is made to call it. When you implement Event Sink say in C++ you use Advise – Unadvise paradigm to assign and clean up your handlers. What you supposed to do in VB6? Any help will be appreciated.
-
You are right. But you replied to the question in all the forums. As a result, the question does not appear in "Unanswered questions" list in none of the forums, so will hardly get a chance to be answered :(
Sincerely, Elina Life is great!!! Enjoy every moment of it! :-O