如何在java eclipse插件中使用自定义OLE dll?

如何在java eclipse插件中使用自定义OLE dll?,java,dll,swt,eclipse-rcp,ole,Java,Dll,Swt,Eclipse Rcp,Ole,我正试图在EclipseRCP插件中使用带有控件的自定义OLE dll dll在我的工作目录中,但是如果我尝试使用它,我会得到一个SWTException: 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)

我正试图在EclipseRCP插件中使用带有控件的自定义OLE dll

dll在我的工作目录中,但是如果我尝试使用它,我会得到一个SWTException:

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)
  ...
我使用以下代码:

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();
然后得到这个例外:

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)
  ...
org.eclipse.swt.swt异常:在注册表中找不到类ID
位于org.eclipse.swt.ole.win32.ole.error(ole.java:317)
位于org.eclipse.swt.ole.win32.ole.error(ole.java:283)
在org.eclipse.swt.ole.win32.OleClientSite上。(OleClientSite.java:226)
...
我如何告诉我的插件在哪里查找类ID?
我肯定缺少一些基本点,但我没有找到关于使用自定义OLE DLL的任何信息。

经过多次尝试和错误,我找到了问题的解决方案:

我的Dll已注册到:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm
相反,我将其注册到:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm

它成功了。我不知道为什么会有不同的版本。

经过多次尝试和错误,我找到了解决问题的方法:

我的Dll已注册到:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm
相反,我将其注册到:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm

它成功了。我不知道为什么会有不同的版本。

我认为您必须指定文件的完整路径。TestControl是文件类型吗?我认为您必须指定文件的完整路径。TestControl是文件类型吗?如何注册到\Microsoft.NET\Framework64\v4.0.30319\regasm如何注册到\Microsoft.NET\Framework64\v4.0.30319\regasm