By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,582 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,582 IT Pros & Developers. It's quick & easy.

Force termination of COM object?

P: n/a
I'm developing a wrapper around a series of VB6 plugins that I now want to
be able to run in my VB.NET application.

Everything is working fine, except I can't find a way to get the
Class_Terminate from the VB6 classes to fire when I've finished with the
objects.

In VB6, these obviously fire when the last reference to the object is set to
Nothing. In .NET, this doesn't happen until I close my application (or,
presumably, when the garbage collector next runs).

Is there any way that I can force the VB6 classes to terminate? Some of them
have clean-up code in their Terminate events, and without running this I'm
worried that I may end up leaving resources locked. I have a Dispose method
in my .NET wrapper class so I have a point in code at which I could trigger
the termination, but I can't find a way to make it happen.

My thanks in advance,

--

(O) e n o n e
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Have a look at System.Runtime.InteropServices.Marshal.ReleaseComO bject.

Hope this helps,

Nick Hall
"Oenone" <oe****@nowhere.com> wrote in message
news:AD******************@newsfe1-win.ntli.net...
I'm developing a wrapper around a series of VB6 plugins that I now want to
be able to run in my VB.NET application.

Everything is working fine, except I can't find a way to get the
Class_Terminate from the VB6 classes to fire when I've finished with the
objects.

In VB6, these obviously fire when the last reference to the object is set
to
Nothing. In .NET, this doesn't happen until I close my application (or,
presumably, when the garbage collector next runs).

Is there any way that I can force the VB6 classes to terminate? Some of
them
have clean-up code in their Terminate events, and without running this I'm
worried that I may end up leaving resources locked. I have a Dispose
method
in my .NET wrapper class so I have a point in code at which I could
trigger
the termination, but I can't find a way to make it happen.

My thanks in advance,

--

(O) e n o n e

Nov 21 '05 #2

P: n/a
Nick Hall wrote:
Have a look at
System.Runtime.InteropServices.Marshal.ReleaseComO bject.


Ah, that's absolutely perfect, thank you very much.

--

(O) e n o n e
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.