如何使用JACOB创建对象 [英] How to create an object using JACOB
问题描述
我设法加载两个dll的
I managed to load two dll's
System.load("C:\\Program Files (x86)\\EXAMPLE Client\\Bin\\EXAMPLE.Client.SDK.dll");
System.load("C:\\Program Files (x86)\\EXAMPLE Client\\Bin\\EXAMPLE.Common.SDK.dll");
下一步是在对象调用上创建 SDKModel
。我该怎么做呢?我试过了:
Next step is to create on object calls SDKModel
. How do I do this? I tried:
ActiveXComponent example = new ActiveXComponent(EXAMPLE.Common.SDK.SDKModel);
然后我得到以下异常:
Exception in thread "main" com.jacob.com.ComFailException: Can't get object clsid from progid
我不确定我是否走在正确的轨道上。如何创建对象 SDKModel
?
I'm unsure whether I'm on the right track. How would create the object SDKModel
?
推荐答案
因为你没有'在系统中注册了你的dll。在两个代码中检查 cd
的路径
Its because you didn't registered your dll in system. Check path of cd
in both code
要注册,请按照[important:小心使用 regasm.exe 因为它与取消注册不同的文件]
To register follow [important: Be careful using regasm.exe as it different file than unregister]
c:
cd\
cd C:\Windows\Microsoft.NET\Framework64\v2.0.50727
RegAsm /verbose /nologo /codebase D:\path_to_dll\mydll.dll
取消注册关注
c:
cd\
cd C:\Windows\Microsoft.NET\Framework\v2.0.50727
RegAsm.exe /unregister D:\path_to_dll\mydll.dll
更新:
注册/取消注册使用 C:\ Windows \ Microsoftoft.NET\Framework\v2.0.50727
framework ..
To register / Unregister use C:\Windows\Microsoft.NET\Framework\v2.0.50727
framework..
这篇关于如何使用JACOB创建对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!