When ActiveX controls are created at run time, there is a need to embed a license key for the controls in the program itself while running the exe else a nag screen will be thrown.
This is not required while dropping controls onto form at design time. In that case the license key becomes embedded into the executable by the development environment only.
In this blog we will discuss the detailed steps to embed the license key for ActiveX controls.
In order to explain the steps, 'C1FlexGrid8.0' control is used as an appropriate example -
1) The first step is to find the license present in the registry. To do so, run the utility "COMLicenceFinder.exe" . This utility can be found in the sample attached with this blog.
2) Check for ComponentOne Flexgrid 8.0 in "COMLicenceFinder".
3) Under the license text, License entry for the control is observed. Copy the entry from there. Please refer to the image below for more clarity.
4) Now open the attached sample in VB6 and paste the copied license in the codeline mentioned below of Form1: StrLicenseKey = Licenses.Add("VSFlexGrid8.VSFlexGridADO.1?, "Type/paste your license key here")
Licenses.Add method accepts two parameters relative ProgramId of ActiveX Controls and the license. This is the key code line to embed license in ActiveX control.
Relative Program ID can be found using axhelper.exe utility.
5) Now run the sample and see that no nag screen is observed for "C1Flexgrid8.0" even though it has been added at run time.
Below are the steps for how to use axhelper.exe utility :
a) Run the application "axhelper.exe".
b) Select the option "Load ActiveX list from the following Registry key and Press 'ok' button. This will create 'ProgId' for all the ActiveX controls present in the system and the purpose is solved.
Similarly, licenses can be embedded for other ComponentOne controls created dynamically at run time.