I ran the comfyj demo and samples and saw the embedded IE browser is a headless one, that is, no title, no address bar, no toolbar, and no status bar, etc.. I was wondering if I can create an complete IE browser with every thing using some thing like,
OleContainer.createObject("Shell.Explorer");
Thanks,
Cobble S.
Here is what I have tested and with no result.
Automation automation = new Automation(oleContainer.getOleObject(), true);
automation.setProperty("AddressBar", Boolean.TRUE);
automation.setProperty("ToolBar", Boolean.TRUE);
automation.setProperty("MenuBar", Boolean.TRUE);
automation.invoke("Navigate2", new Object[] { "www.teamdev.com" });
No bars shown on the top.
Apprecaite helps in advance,
Cobble S.
Hi Cobble,
Even though these properties are available in the API of WebBrowser ActiveX component, on practice we have never seen that they could be enabled if a WebBrowser component is being used as an embedded component outside IE application.
But if you run IE without embedding as a separate application then changing of these properties will work. The example below demonstrates it:
public static void main(String[] args) throws Exception {
ComFunctions.coInitialize();
final CLSID CLSID_InternetExplorer = new CLSID("{0002DF01-0000-0000-C000-000000000046}");
IDispatchImpl webBrowser = new IDispatchImpl(CLSID_InternetExplorer, ClsCtx.LOCAL_SERVER);
final boolean useCurrentThread = true;
Automation webBrowserAutomation = new Automation(webBrowser, useCurrentThread);
webBrowserAutomation.setProperty("Visible", Boolean.TRUE);
webBrowserAutomation.setProperty("AddressBar", VariantBool.TRUE);
webBrowserAutomation.setProperty("ToolBar", VariantBool.FALSE);
webBrowserAutomation.setProperty("MenuBar", VariantBool.FALSE);
webBrowserAutomation.setProperty("StatusBar", VariantBool.FALSE);
webBrowserAutomation.invoke("Navigate2", "http://www.teamdev.com");
System.out.println("Press 'Enter' to terminate application");
System.in.read();
webBrowserAutomation.invoke("Quit");
webBrowserAutomation.release();
webBrowser.setAutoDelete(false);
webBrowser.release();
System.out.println("Done");
}
Please let me know if you have any further questions.
-Serge
Serge,
Thanks for the answer and the sample code.
Previously I also tested another open source for java & Component bridge and got the IE Browser with everything (menubar, et al) but it's not an embeded component within a java app. So you are correct to point this.
It is also found from the demo samples that some of MS office apps, like, MS word and MS Excel have almost everything shown even as an embeded components, but some of them did not, like MS Power Point and IE Browser. I am not sure if it is totally up to the MS Office APIs.
Thanks again,
Cobble S.