General Articles and Tutorials

Embedding License Information in Your Application

Author: Mike Palmatier
Platform: Visual Basic 6.0, Visual C#, Visual Basic .NET

There are some situations that you may need to include the content of the LIC file in your control using the License property. You DO NOT include the actual LIC file. For example, if you develop in C# you will need to include the license information, if you are developing an ActiveX control for Internet Explorer, you will need to include the license information, or if you are creating an ActiveX control that uses\included a Codejock component you will need to include the license information. There might be other situations where this is needed as well.

The License property is located in the GlobalSettings class for each control. The code below illustrates how to use the License property for each control used.

You will need to provide the correct Product Id and Validate Code. This information can be found in the LIC file. The LIC file is located in the same location as the OCX file. By default, the location of the OCX and LIC file is the "..\Program Files\Codejock Software\ActiveX\Suite Pro ActiveX 2006 Q2\bin" for the Suite Pro installation. This code should be included before any controls are creates, for example, in thee Form_Initialize event of the main form for Visual Basic 6.0. For simplicity, the code below demonstrates how to embed the license information for the CommandBars only, you will need to do this for each control you use.

Private Sub Form_Initialize()

    CommandBarsGlobalSettings.License = "CommandBars Control Copyright (c) " & _
    "2003-2006 Codejock Software" & vbCrLf & "PRODUCT-ID: " & _
    "Codejock.CommandBars.ActiveX.v10.20" & vbCrLf & _
    "VALIDATE-CODE: XXX-XXX-XXX-XXX"

End Sub
public frmMain()
{
    XtremeCommandBars.CommandBarsGlobalSettingsClass CommandBarsSettings =
        new XtremeCommandBars.CommandBarsGlobalSettingsClass();

    CommandBarsSettings.License =
        "CommandBars Control Copyright (c) 2004-2006 " +
        "Codejock Software\r\n" +
        "PRODUCT-ID: Codejock.CommandBars.ActiveX.v10.20\r\n" +
        "VALIDATE-CODE: XXX-XXX-XXX-XXX";

    //
    // Required for Windows Form Designer support
    //
    InitializeComponent();

}
Public Sub New()
    MyBase.New()

    Dim CommandBarsSettings As _
        XtremeCommandBars.CommandBarsGlobalSettingsClass = _
        New XtremeCommandBars.CommandBarsGlobalSettingsClass

    CommandBarsSettings.License = "CommandBars Control Copyright (c) " + _
    "2003-2006 Codejock Software" + ControlChars.CrLf + "PRODUCT-ID: " + _
    "Codejock.CommandBars.ActiveX.v10.20" + ControlChars.CrLf + _
    "VALIDATE-CODE: XXX-XXX-XXX-XXX"

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent() call

End Sub