通过COM使用Licensed .NET UserControls [英] Using Licensed .NET UserControls via COM

查看:62
本文介绍了通过COM使用Licensed .NET UserControls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个基于ATL的COM控件( CMWebDocViewerATL.dll )这是我们遗留的Web应用程序的一部分。 
CMWebDocViewerATL 是用C ++编写的,并使用另一个控件( cmdv.ocx )是在Visual Basic中开发的
。  
CMWebDocViewerATL
创建
cmdv
使用此机制:

We have an ATL based COM Control (CMWebDocViewerATL.dll) that is part of our legacy web application.  CMWebDocViewerATL is written in C++ and makes use of another control (cmdv.ocx) that was developed in Visual Basic.   CMWebDocViewerATL creates an instance of cmdv using this mechanism:

CAxWindow2 m_DVControl;

m_DVControl.Create(m_hWnd,rectSize,0,WS_CHILD | WS_VISIBLE,0,42);

m_DVControl.ModifyStyle(WS_HSCROLL | WS_VSCROLL,0);

HRESULT result = m_DVControl。 CreateControlLic (DV_PROG_ID,0,0,key);

HRESULT result = m_DVControl.CreateControlLic(DV_PROG_ID, 0, 0, key);

请注意使用Windows API
CreateControlLic
。  
cmdv
是一个复合控件,包含其他3< sup> rd< / sup> -party许可控件( GDPicture和TxText ),所以它也必须获得许可,以便在Internet Explorer中正确加载

Note the use of the Windows API CreateControlLic cmdv is a composite control that contains other 3<sup>rd</sup>-party licensed controls(GDPicture and TxText), so it also has to be licensed in order for everything to be loaded properly within Internet Explorer.

我们正在替换
cmdv.ocx
,基于.NET4.5的
System.Windows.Forms.UserControl
CMDocViewer.dll )群组。
CMDocViewer
是用C#编写的,它也是启用COM以便
CMWebDocViewerATL
可以轻松调用其方法。 

We are replacing cmdv.ocx with a .NET4.5-based System.Windows.Forms.UserControl (CMDocViewer.dll).  CMDocViewer is written in C#, and it is also COM-enabled so that CMWebDocViewerATL can easily invoke its methods. 

我不清楚的是如何正确许可
CMDocViewer

这样
CMWebDocViewerATL
可以通过
m_DVControl.CreateControlLic

以便根据需要许可所有内容和所有控件,包括嵌入式3< sup> rd< / sup> -party控件(也是许可的)完全正常运作。

What is unclear to me is how to properly license CMDocViewer such that CMWebDocViewerATL can create an instance of it via m_DVControl.CreateControlLic so that everything is licensed as needed and all of the controls, including the embedded 3<sup>rd</sup>-party controls(which are also licensed), are fully functional.

在研究许可时,我遇到了两种可能的方法。

While researching licensing, I’ve come across two possible approaches.

使用IClassFactory2

Use IClassFactory2

使用  System.ComponentModel.LicenseProvider

Use  System.ComponentModel.LicenseProvider

我不清楚Visual Studio项目的实现和配置实际需要什么。

It is unclear to me what is actually required as far as implementation and configuration of Visual Studio projects.

在此先感谢为了您的帮助

Thanks In Advance For Your Help

Jay

推荐答案

嗨Jay,

>>我不清楚如何正确许可CMDocViewer

>>What is unclear to me is how to properly license CMDocViewer

我注意到  CMDocViewer是一个用C#自己创建的dll,对吗?所以它只是一个dll而不是COM,如果你想在其他项目中使用它,你只需要添加它作为参考,你不需要
注册它:

I noticed the CMDocViewer is a dll created with C# by yourself, right? So it is just a dll instead of a COM, you just need to add it as a reference if you want to use it in other project, you do not need to register it:

我无法理解你的意思"如何正确许可CMDocViewer",  如果你只是为自己使用它,那么你不需要授权它。

I can not understand what you mean that "how to properly license CMDocViewer", If you just use it for yourself, then you do not need to authorize it.

>> ; CMDocViewer是用C#编写的,它也支持COM,因此CMWebDocViewerATL可以轻松调用其方法。 

>>CMDocViewer is written in C#, and it is also COM-enabled so that CMWebDocViewerATL can easily invoke its methods. 

如果  CMDocViewer是用C#编写的,那你的意思是"它是COM-启用"?我担心它不是COM,它只是一个常见的dll,你只需要将它用作o rdinary
dll。

If the CMDocViewer is written in C#, what do you mean that "it is COM-enabled"? I'm afraid it is not a COM, it is just a common dll, you just need to use it as an ordinary dll.

如果我误解你的意思,请告诉我。

Please let me know if I misunderstand what you mean.

问候,

Frankie


这篇关于通过COM使用Licensed .NET UserControls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆