查看: 3186|回复: 4


发表于 2012-3-1 19:12:04 | 显示全部楼层 |阅读模式
我做了一个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? ... 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
2. Compile and run the dynamicControl project.The CWGraph control runs in evaluation mode.
3. Unzip the 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.

- 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 file.
附件里Licreqst.rar是我编译好的,licenseutility.zip是源代码,dynamic_control_vc.zip是例程。 (2.41 MB, 下载次数: 74)
 楼主| 发表于 2012-3-1 19:15:20 | 显示全部楼层
发表于 2015-10-28 16:32:23 | 显示全部楼层
发表于 2015-10-28 16:33:51 | 显示全部楼层
发表于 2015-10-28 16:34:16 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册


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

GMT+8, 2019-1-17 10:58 , Processed in 0.029666 second(s), 27 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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