package de.tutorials;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.ole.win32.OleAutomation;
import org.eclipse.swt.ole.win32.OleClientSite;
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 SWTVideoPlayer {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("SWT Video Player");
shell.setSize(640, 480);
shell.setLayout(new FillLayout());
OleFrame frm = new OleFrame(shell, SWT.NONE);
OleClientSite site = new OleClientSite(frm, SWT.NONE,
"MediaPlayer.MediaPlayer.1");
OleAutomation auto = new OleAutomation(site);
int[] ids = null;
ids = auto.getIDsOfNames(new String[] { "Open" });
auto.invoke(ids[0],
new Variant[] { new Variant("C://WINNT//clock.avi") });
ids = auto.getIDsOfNames(new String[] { "Play" });
auto.invoke(ids[0]);
shell.open();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
site.deactivateInPlaceClient();
site.dispose();
auto.dispose();
}
}