2015-12-15 66 views
1

我想在我的Eclipse RCP插件中使用帶有控件的自定義OLE dll。如何在java eclipse插件中使用自定義的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的信息。

+0

我想你必須指定文件的完整路徑。 TestControl是一種文件類型嗎? – SomeDude

回答

0

了很多嘗試和錯誤後,我發現我的問題的解決方案:

我的DLL與註冊:

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

相反,我用它註冊:

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

和有效。我不知道爲什麼有不同的版本。

+0

如何註冊到\ Microsoft.NET \ Framework64 \ v4.0.30319 \ regasm –

相關問題