I'm trying to use a custom OLE dll with a control in my Eclipse RCP Plugin.
The dll is in my working directory, but if I try to use it I get a SWTException:
I use this code:
Display display = Display.getCurrent();
Shell shell = new Shell(display);
OleFrame frame = new OleFrame(shell, SWT.NONE);
OleClientSite site = new OleClientSite(frame, SWT.NONE, "MyCustomDll.TestControl");
OleAutomation test = new OleAutomation(site);
shell.open();
And get this Exception:
org.eclipse.swt.SWTException: Class ID not found in registry
at org.eclipse.swt.ole.win32.OLE.error(OLE.java:317)
at org.eclipse.swt.ole.win32.OLE.error(OLE.java:283)
at org.eclipse.swt.ole.win32.OleClientSite.<init>(OleClientSite.java:226)
...
How can I tell my plugin where to look for the Class ID? There must be some basic point I'm missing but I didn't find anything about using custom OLE dlls.
After a lot of try and error I found the solution for my Problem:
My Dll was registered with:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm
Instead I registered it with:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm
and it worked. I don't know why there are different versions anyway.