I am sending you the code that I wrote to start a ole window.The
following code tries to start the application in a separate window. (
To run this code as an application we need to have swt library )


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.*;
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,
      "Vim.Application");//<--Error is coming here
   oleControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
   shell.open();

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


This is the error mesg:
Exception in thread "main" org.eclipse.swt.SWTException: Failed to
create Ole Client. result = -2147221164
        at org.eclipse.swt.ole.win32.OLE.error(OLE.java:302)
        at 
org.eclipse.swt.ole.win32.OleControlSite.<init>(OleControlSite.java:101)
        at SWTOleFrame.main(SWTOleFrame.java:23)


When I replaced the "Vim.Application" with "Shell.Explorer" it is
working fine, an IE window is opening.


On 4/25/07, Sebastian Menge <[EMAIL PROTECTED]> wrote:
Am Dienstag, den 24.04.2007, 16:46 +0530 schrieb Nageshwar M:
> I tried all the options I checked :version and there is this line
> "with OLE support". I tried to run the application from python as said
> in documentation and its working fine there. But from java with swt
> library I'm getting the same error.

Please give more information: Perhaps it's a java problem? Can you post
(some of) your code? Then we could try to reproduce it.

Sebastian.



Thanks,
Nageshwar M

Reply via email to