LabVIEW论坛

 找回密码
 注册

扫一扫,访问微社区

查看: 3164|回复: 4

动态生成Graph控件时的License问题

[复制链接]
发表于 2012-3-1 19:12:04 | 显示全部楼层 |阅读模式
USB-6009数据采集卡首发
我做了一个VC程序用到Graph控件,发布程序后运行总说我未注册,明明是pj了调试时没问题。在网上搜了很久才明白,在Dialog上手动添加一个Graph控件时,license信息自动添加进去了。而我是在CWnd里动态添加生成Graph控件时,必须手动指定一个有效的license信息。这个在手册里没讲,不过在NI的NI Home > Support > KnowledgeBase里有人提到相同的问题:
How Do I Create Controls Dynamically in Microsoft Visual C++ When Using MFC without the Demo Mode Message Window?
http://digital.ni.com/public.nsf ... 7C3672?OpenDocument
里面有解决方案,但链接好像打不开了,幸亏我保存了一份,贴在下面:
==============================================
This example demonstrates how to dynamically create a Measurement Studio CNiGraph control and add the appropriate license string for the control to prevent it from running in evaluation mode.

You can dynamically create licensed Measurement Studio controls in Microsoft Visual C++. To prevent controls from running in evaluation mode, you must include a run-time license string in the source code to create the control when the program is executed. You can use the Microsoft License Key Request Utility to create the run-time license string from the control development license. When you run this utility, it returns the appropriate run-time license string for any registered control you select.

To create one of the Measurement Studio ActiveX controls at run-time, use one of the following functions: Create(...) or CreateControl(....). These functions are available for all Visual C++ ActiveX controls that ship with Measurement Studio. You pass the license key data to these functions as a string parameter. The license key data is necessary for creating any control that requires a run-time license key. If this license key is missing, the control is created in evaluation mode.

Complete the following steps to use this example program:
1. Unzip DynamicControl_VC.zip.
2. Compile and run the dynamicControl project.The CWGraph control runs in evaluation mode.
3. Unzip the LicenseUtility.zip file and compile the project with Visual C++ 6.0 or later.
4. Run LICREQST.exe and select CWUIControlsLib.CWGraph.1.
5. In License Key Data for Currently Selected Control, select and copy the text inside the curly brackets.
6. In the dynamicControl project, paste the data you copied, which is the license string, between the curly brackets for WCHAR pwchUILic[].
The OnButton1 function contains code that converts the license string from a WCHAR to BSTR so you can use it in the CNiGraph::Create function.
7. Compile and run the dynamicControl project.The CWGraph control no longer runs in evaluation mode.

IMPORTANT INFORMATION:
- You must modify the license string provided in the dynamicControl example. It is not an actual license and will not work.
- You cannot distribute source code that includes Measurement Studio run-time licenses to anyone who does not own an equivalent Measurement Studio development license.
- LICRQST.EXE is a Microsoft file and is redistributed according to the license agreement, legal.txt, which is included in the LicenseUtility.zip file.
=================================================
附件里Licreqst.rar是我编译好的,licenseutility.zip是源代码,dynamic_control_vc.zip是例程。
licenseutility.zip (2.41 MB, 下载次数: 74)
IDAQ-USB-6009数据采集卡
 楼主| 发表于 2012-3-1 19:15:20 | 显示全部楼层
在线课堂
谢谢让我加好友的网友,要不然还发不了贴。
发表于 2015-10-28 16:32:23 | 显示全部楼层
两个源码,一个执行文件
发表于 2015-10-28 16:33:51 | 显示全部楼层
不知掉为什么发在这边,没看到和NI控件有关心的
发表于 2015-10-28 16:34:16 | 显示全部楼层
而且还是用三个,中间为执行文件
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|无图浏览|手机版|网站地图|虚拟仪器家园 ( 沪ICP备06029130号-1 )

GMT+8, 2018-10-23 15:45 , Processed in 0.038666 second(s), 24 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表