Licensing ComponentOne controls in Visual C++

Licensing model of VC++ application is different from WinForms applications. Unlike C# and VB.NET, the VS.NET compiler for managed C++ applications does not automatically embed the keys for licensed controls. This blog explains how you can embed license for ComponentOne controls for Winforms. In VC++ applications even if the project has valid license but these applications do not recognize it and throws a nag screen. This is caused by LicenseContext.SetSavedLicenseKey method because it cannot serialize license information into C++ assembly. Please follow the steps mentioned below to generate license resource file which can then be added to our project to license ComponentOne controls:-

  1. Copy CPPApplication's complete project folder in C: drive
  2. Open a command prompt of Visual Studio using 'Run as administrator' option
  3. Use this below mentioned command to generate a license resource file named CPPApplication.exe.licenses: lc /target: /complist:\licenses.licx /outdir:c: /i:\.dll For instance : For licensing C1Editor control in VC++ application then the command would look like: lc /target:CPPApplication.exe /complist:C:\CPPApplication\CPPApplication\licenses.licx /outdir:c: /i:C:\CPPApplication\Debug\C1.Win.C1Editor.4.dll
  4. Now add CPPApplication.exe.licenses( from C: /CPPApplication project folder) into CPPApplication project
  5. Open properties of cppapplication.exe.licenses file and change 'Item Type' to 'Compiled Managed Resource'
  6. Rebuild the project, CPPApplication.exe will run successfully without Nag screen.

This will license ComponentOne controls in VC++ applications if you have a valid license. To activate your license, you may refer to this link.


GrapeCity Developer Tools
comments powered by Disqus