Releasing COM objects

ardu

New member
Joined
Jun 12, 2003
Messages
3
I am using web browser controll (shdocvw.dll) to load a
local html page containing a third-party ActiveX object
(which cannot be imported directly into the windows
application). Browser crashes when I try to navigate to
another page containing the same ActiveX object and I
thought of disposing of my browser object hoping that this
will dispose of the ActiveX object too, and then to create
a new instance and navigate to the second page. (When
using Internet Explorer, this was the only way - close the
IE and open it again).

I instantiate with:
axWebBrowser1 = new AxSHDocVw.AxWebBrowser();

I have found that Marshal.ReleaseComObject(obj) might be
the way, but it is not clear to me what is the obj in my
case.

I have tried Marshal.ReleaseComObject(axWebBrowser1); but
I got InvalidCast exception.

Thanks for help
Dusan
 
If the ActiveX control is hosted in Internet Explorer, then it should be Internet Explorer that is responsible for disposing of it when another page is navigated to.
 
Hi, some additional thoughts re you reply to my question:

It seems to me that IE either standalone or as hosted control cannot dispose of this particular ActiveX object before navigating to other page (or refresshing the same one!). Therefore, my idea was to kill IE controll hoping that it will take to the heaven the ActivX object too.

I just do not know which gun to use...

Dusan
 
ardu said:
Hi, some additional thoughts re you reply to my question:

It seems to me that IE either standalone or as hosted control cannot dispose of this particular ActiveX object before navigating to other page (or refresshing the same one!). Therefore, my idea was to kill IE controll hoping that it will take to the heaven the ActivX object too.

I just do not know which gun to use...

Dusan

Hi !
I have the same problem and I tried to make the ActiveX object kill itself by using low level exit, but all that resulted in was to stop aspnet_xp.exe and the the page would get an exception, so I think that the problem is not to kill IE control, since aspnet_xp.exe has some sort of watch-dog feature, enabling it again, sending you in to the same problem.... hmmmm!
If you find a quick and dirty way to do this, then I would really appreciate
if you send a reply to me on jserup@tpradio.dk

- Johnny
 
Back
Top