FULLY releasing a COM Object?

J

joecool1969

I have a .NET 3.5 class library that is an automated front-end to a
third party app that I have no control or access to the source. We do
have an SDK the owners of the app have provided. When my calling test
app (VB6) tells the automation layer to create an instance of the
third party app, it's EXE shows up in the task manager's process list.

We would like the calling app, the VB6 test app in this case, to be
able to invoke the third party app's logout and quit method from the
SDK interface so that the calling can create another instance of the
third party app without having to shutdown.

So, when the user wishes to logout, we want to totally kill the
process. And when the Logoff method in the automation layer is
invoked, the third party app shuts down. But if the calling app tried
to create another instance, it fails. We see that the third party
app's EXE still shows up in the process list even though the
automation layer's logoff method releases the com object with a
Marshal.ReleaseComObject method.

If I manually kill the process, the calling app can create the new
instance just fine. And when the calling app is shut down, the EXE
disappears from the process list.

What is the "proper" way to kill that process?
 
P

Pavel Minaev

I have a .NET 3.5 class library that is an automated front-end to a
third party app that I have no control or access to the source. We do
have an SDK the owners of the app have provided. When my calling test
app (VB6) tells the automation layer to create an instance of the
third party app, it's EXE shows up in the task manager's process list.

We would like the calling app, the VB6 test app in this case, to be
able to invoke the third party app's logout and quit method from the
SDK interface so that the calling can create another instance of the
third party app without having to shutdown.

So, when the user wishes to logout, we want to totally kill the
process. And when the Logoff method in the automation layer is
invoked, the third party app shuts down. But if the calling app tried
to create another instance, it fails. We see that the third party
app's EXE still shows up in the process list even though the
automation layer's logoff method releases the com object with a
Marshal.ReleaseComObject method.

Depending on what you do with the objects you get from the app,
ReleaseComObject may not be enough. Try using FinalReleaseComObject
and see if that helps (and while you're at it, read its description to
see what the difference is).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top