【问题标题】:How to use a custom OLE dll in a java eclipse plugin?如何在 java eclipse 插件中使用自定义 OLE dll?
【发布时间】:2015-12-15 07:14:04
【问题描述】:

我正在尝试在我的 Eclipse RCP 插件中使用带有控件的自定义 OLE dll。

该 dll 在我的工作目录中,但如果我尝试使用它,我会收到 SWTException:

我使用这个代码:

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)
  ...

如何告诉我的插件在哪里寻找类 ID? 一定有一些我遗漏的基本点,但我没有找到任何关于使用自定义 OLE dll 的信息。

【问题讨论】:

  • 我认为你必须指定文件的完整路径。 TestControl 是文件类型吗?

标签: java dll swt eclipse-rcp ole


【解决方案1】:

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

我的 Dll 注册于:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\regasm

相反,我注册了它:

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

它奏效了。我也不知道为什么会有不同的版本。

【讨论】:

  • 如何注册到\Microsoft.NET\Framework64\v4.0.30319\regasm
猜你喜欢
  • 1970-01-01
  • 2010-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-31
  • 1970-01-01
  • 2013-08-17
相关资源
最近更新 更多