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:-
- Copy CPPApplication's complete project folder in C: drive
- Open a command prompt of Visual Studio using 'Run as administrator' option
- 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 - Now add CPPApplication.exe.licenses( from C: /CPPApplication project folder) into CPPApplication project
- Open properties of cppapplication.exe.licenses file and change 'Item Type' to 'Compiled Managed Resource'
- 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.