subject_44227.htm

来自「一些关于vc的问答」· HTM 代码 · 共 18 行

HTM
18
字号
<p>
序号:44227 发表者:AllTools 发表日期:2003-06-17 17:05:58
<br>主题:如何在ActiveX控件中加License
<br>内容:我做了一个啊ActiveX控件,想加入License控制(Design Mode或Runtime License),看了MSDN,没明白,哪位大虾指教一二?
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:vczhao 回复日期:2003-06-20 15:23:21
<br>内容:如果你的ActiveX控件使用MFC做的话,开始有是否使用license的选项,却省是不用的;<BR>如果忘记选择了也可以手工加进去。<BR><BR>*Ctrl.h文件中加入<BR>&nbsp;&nbsp;&nbsp;&nbsp;BEGIN_OLEFACTORY(CMapdayCommCtrl)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Class factory and guid<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL VerifyUserLicense();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;virtual BOOL GetLicenseKey(DWORD, BSTR FAR*);<BR>&nbsp;&nbsp;&nbsp;&nbsp;END_OLEFACTORY(CMapdayCommCtrl)<BR><BR>*Ctrl.cpp文件中加入:<BR>/////////////////////////////////////////////////////////////////////////////<BR>// Licensing strings<BR><BR>static const TCHAR BASED_CODE _szLicFileName[] = _T("mapdaycomm.lic");<BR><BR>static const WCHAR BASED_CODE _szLicString[] =<BR>&nbsp;&nbsp;&nbsp;&nbsp;L"MapdayComm License";<BR><BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CMapdayCommCtrl::CMapdayCommCtrlFactory::VerifyUserLicense -<BR>// Checks for existence of a user license<BR><BR>BOOL CMapdayCommCtrl::CMapdayCommCtrlFactory::VerifyUserLicense()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;return AfxVerifyLicFile(AfxGetInstanceHandle(), _szLicFileName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_szLicString);<BR>}<BR><BR><BR>/////////////////////////////////////////////////////////////////////////////<BR>// CMapdayCommCtrl::CMapdayCommCtrlFactory::GetLicenseKey -<BR>// Returns a runtime licensing key<BR><BR>BOOL CMapdayCommCtrl::CMapdayCommCtrlFactory::GetLicenseKey(DWORD dwReserved,<BR>&nbsp;&nbsp;&nbsp;&nbsp;BSTR FAR* pbstrKey)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (pbstrKey == NULL)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return FALSE;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;*pbstrKey = SysAllocString(_szLicString);<BR>&nbsp;&nbsp;&nbsp;&nbsp;return (*pbstrKey != NULL);<BR>}<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:vczhao 回复日期:2003-06-20 16:00:33
<br>内容:可以参考一下<BR>http://www.mypcera.com/softxue/new/vc/vcc7.htm
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?