Re: IE to the front
Reuben Sivan <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
Thanks for the tip.
It appears that this happens only on some OS versions, for example, I
experience that problem under Windows 2003 server, but not under WIndows
XP Professional.
BTW my old email address is no longer in use, please reply to this one if
you want a timely reply.
Following is a sample piece of code to invoke IE through COM:
import org.jawin.COMException;
import org.jawin.DispatchPtr;
import org.jawin.win32.Ole32;
public class TestIE {
public static void main(String args[]) {
try {
// init Ole32
Ole32.CoInitialize();
// get application dispatch
DispatchPtr ptr = new DispatchPtr
("InternetExplorer.Application");
// navigate to desired url
ptr.invoke("Navigate", "http://www.yahoo.com");
// make visible
ptr.put("Visible", true);
// cleanup
ptr.close();
Ole32.CoUninitialize();
} catch (COMException e) {
e.printStackTrace();
} finally {
}
}
}