简体   繁体   English

DTSearch COM Interop - 如何向C#公开对象?

[英]DTSearch COM Interop - How do I expose objects to C#?

I know, I'm taking a gamble here. 我知道,我在这里赌博。 I don't know if I can even be helped on this one at all. 我不知道我是否可以在这个问题上得到帮助。 But, here is the problem. 但是,这是问题所在。

The company I work for has a fully licensed, if old, developer copy of DTSearch including the C++ source. 我工作的公司拥有DTSearch的完全许可(如果有的话)开发人员副本,包括C ++源代码。 They use this in an application I'm updating. 他们在我正在更新的应用程序中使用它。 I've been told to make use of it in the C# additions to this app that are currently being worked on. 我被告知要在当前正在使用的这个应用程序的C#中添加它。 However, I don't have the .NET assembly and they refuse to implement it for some reason. 但是,我没有.NET程序集,并且由于某种原因拒绝实现它。

So, I can easily view dtengine in the Object Browser and there are lots of lovely objects waiting for me to use them. 因此,我可以在对象浏览器中轻松查看dtengine,并且有很多可爱的对象等着我使用它们。 But none of them will instantiate. 但是没有一个会实例化。 Attempting it gets me 尝试它让我

'dtengine.SearchJobClass' cannot be embedded. 'dtengine.SearchJobClass'无法嵌入。 Use the applicable interface instead. 请改用适用的界面。

And there are interfaces galore, I can easily implement any of them. 并且有丰富的接口,我可以轻松实现其中的任何一个。 Trouble is, "throw new NotImplementedException" doesn't exactly get my searching done. 麻烦的是,“抛出新的NotImplementedException”并没有完全完成我的搜索。

Does anyone have any clues? 有人有任何线索吗?

I've used some COM objects that you have to instantiate like so: 我已经使用了一些你需要实例化的COM对象:

Foo f = new FooClass();

Does the DTSearch have similar looking class names? DTSearch有类似的类名吗?

I also believe that COM interfaces are special and that you can instantiate a COM object by it's interface though I'm having a hard time finding good examples. 我也相信COM接口是特殊的,你可以通过它的接口实例化一个COM对象,虽然我很难找到好的例子。

I did find this: 我确实发现了这个:

http://www.codeproject.com/KB/COM/COMBasics.aspx http://www.codeproject.com/KB/COM/COMBasics.aspx

note that if you scroll down you'll see them instantiating the Interface in a special way. 请注意,如果向下滚动,您将看到它们以特殊方式实例化接口。 I'm not saying this is a solution but it may help in your investigation of how to use the DTSearch COM wrapper in your application. 我不是说这是一个解决方案,但它可能有助于您研究如何在您的应用程序中使用DTSearch COM包装器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM