[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: OLE Integration
|
1) You need to give the OleFrame some size - either use a layout or set the
bounds.
2) You should use OLE.OLEIVERB_INPLACEACTIVATE
3) You need an event loop
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize (400, 300);
shell.setLayout(new FillLayout());
shell.setText ("Test Shell");
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
OleFrame frame = new OleFrame(shell, SWT.NONE);
File file = new File("C:\\test.doc");
OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, file);
int i = clientSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
"MichaelReh" <michael.reh@xxxxxxx> wrote in message
news:atunlu$i0s$1@xxxxxxxxxxxxxxxx
> Hi,
> has anyone ever used the sample code for the OLE support. On my machine
> the code is not proper working. i.e.
>
> the container shows the menubar of the OLE-Application(Word),but the
> document is nowhere shown. Has anybody an idea ? Find below a snopshot of
> my code
>
> public class test {
>
> public static void main(String[] args) {
>
> Display display = new Display();
> Shell shell = new Shell(display);
> OleFrame frame = new OleFrame(shell, SWT.NONE);
> shell.setSize (300, 100);
> shell.setText ("Test Shell");
> Menu bar = new Menu(shell, SWT.BAR);
> shell.setMenuBar(bar);
>
> File file = new File("C:\\Test.doc");
> OleClientSite clientSite = new OleClientSite(frame, SWT.NONE, file);
>
> int i = clientSite.doVerb(OLE.OLEIVERB_UIACTIVATE);
>
>
> }
> }
>
>
> Thanks, Mike
>