Skip to main content

IeEmbed.exe does not go away

5 replies [Last post]
priyakr
Offline
Joined: 2008-02-04

Hi,
I am using JDIC WebBrowser in a JDialog and the JDialog is launced from a JFrame.
I want to be able to pop the JDialog on some user input an then close it later. ( JFrame is the main window I want to keep active)
However, on closing the JDialog i see that the IeEmbed.exe is not terminated in the Task manager.

the IeEmbed.exe goes away only after i close the main Frame ( meaning, my jvm is also terminated)

Is there anything i have to do specifically ... like call any method of WebBrowser before i close the JDialog?

Thanks
Priya

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
madroadie
Offline
Joined: 2006-04-20

Double check the Auto Dispose Parameter when creating the WebBrowser object.

boolean autodispose = false;
WebBrowser browser = new WebBrowser(autodispose);

Madroadie

priyakr
Offline
Joined: 2008-02-04

I tried with both true and false values for AutoDispose - both don't work.

with AutoDispose = false - Nothing happens
with AutoDispose = true I get the following exception when the JDialog is disposed.

Exception in thread "Thread-5" java.lang.NullPointerException: null pData
at sun.awt.windows.WComponentPeer.hide(Native Method)
at java.awt.Component.removeNotify(Component.java:6533)
at org.jdesktop.jdic.browser.WebBrowser.access$201(Unknown Source)

priyakr
Offline
Joined: 2008-02-04

I have now eliminated the exception, but the IeEmbed.exe still exists in task manager until I close the main JFrame window (System.exit(0)).

I instanstiated the WebBrowser with autodispose = false. and then explicity call dispose() before i dispose my JDialog. This elimiates the exception, but does not remove the IeEmbed.exe in the task manager.

I could not find a way to explicity trigger the WebBrowserEvent.WEBBROWSER_CLOSE either. Has anyone encountered my problem at all?

madroadie
Offline
Joined: 2006-04-20

Yes, most of the time you want to keep ieembed around until the app shuts down.

So you should listen application frame shutdown events. However this needs to be done at the application level, you could have another window using an instance. For example you have a tabbedPane etc.

In my class that extends WebBrowser I do something like this.

public void onApplicationShutdown()
{
if (!this.isAutoDispose() && !this.isDisposed())
this.dispose();
else
System.out("Not Shutting down the webbrowser");
}

priyakr
Offline
Joined: 2008-02-04

OK, Sounds about right. ( I also see no exceptions in my debug window)

So in conclusion,
1) instantiate browser with autodispose = false in dialog
2) invoke browser.dispose explicitly before disposing the parent dialog.
browser.dispose() disposes the browser but the process ieembed.exe is not destroyed.
3) ieembed.exe is automatically removed when main application JFrame shuts down with System.exit(0).
4) There isn't an explicit way that the code can terminate iembed.exe without exiting.

Please do let me know if i got it right. I really appreciate all the help.