SWT Ole Frame : WIN32 « SWT JFace Eclipse « Java






SWT Ole Frame

SWT Ole Frame

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.ole.win32.OLE;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleControlSite;
import org.eclipse.swt.ole.win32.OleFrame;
import org.eclipse.swt.ole.win32.Variant;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class SWTOleFrame {

  public static void main(String[] args) {

    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(600, 400);
    shell.setLayout(new FillLayout());

    OleControlSite oleControlSite;

    OleFrame oleFrame = new OleFrame(shell, SWT.NONE);
    oleControlSite = new OleControlSite(oleFrame, SWT.NONE,
        "Shell.Explorer");
    oleControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
    shell.open();

    final OleAutomation browser = new OleAutomation(oleControlSite);

    int[] browserIDs = browser.getIDsOfNames(new String[] { "Navigate",
        "URL" });
    Variant[] address = new Variant[] { new Variant(
        "http://www.oreilly.com") };
    browser.invoke(browserIDs[0], address, new int[] { browserIDs[1] });

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }

    browser.dispose();
    display.dispose();
  }
}



           
       








Related examples in the same category

1.Invoke the system text editor on autoexec.bat
2.Place an icon with a popup menu on the system trayPlace an icon with a popup menu on the system tray
3.OLE and ActiveX example snippet
4.Word OLEWord OLE
5.Invoke an external batch fileInvoke an external batch file
6.Find the icon of the program that edits .bmp filesFind the icon of the program that edits .bmp files
7.Running a script within IE.Running a script within IE.
8.Reading and writing to a SAFEARRAY
9.Embed Word in an applet
10.OLE and ActiveX example: browse the typelibinfo for a program id
11.OLE and ActiveX example: get events from IE controlOLE and ActiveX example: get events from IE control
12.How to access About, Preferences and Quit menus on carbon