Search All Forums
Dart Home | Custom Development Reply | Licensing Issues Topics | Forums   
AuthorForum: Licensing Issues
Topic: Using ActiveX controls dynamically in .NET
K M Drake

From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted December 12, 2002 9:18 AM

When using the ActiveX controls in .NET dynamically (not placing them on a form), steps must be taken to ensure proper licensing. In the example below, Zip is used, but these steps apply to any of the controls.

1) In the project, add a reference to AxDartZip by placing the control on a form. The control (and if necessary, the form) can then be deleted.
2) Use the MS Reflection class to add your licensed control, as shown in the code below.

Private Withevents Zip1 As AxDartZip.AxZip
Private Const SERIAL_NUMBER = "" 'Add Your Serial Number

Zip1 = New AxDartZip.AxZip()
Dim fieldInfo As System.Reflection.FieldInfo
fieldInfo = GetType(System.Windows.Forms.AxHost).GetField("licenseKey", Reflection.BindingFlags.NonPublic Or Reflection.BindingFlags.Instance)
fieldInfo.SetValue(Zip1, SERIAL_NUMBER)


*1 If you are using a licensed object that is not a control (ie, Message object, SnmpMib object), you cannot create a new instance of it. Instead, use a control that has a property with the object as a data type (for example, AxAgent.Mib) and set the new instance to it (Dim Mib As SnmpMib, Set Mib = Agent1.Mib).

*2 You will not be able to use this procedure in a .Net Windows Service, a .Net Web Service, or a .Net Web Application. For these applications, one should use DartZip.ZipClass (not AxDartZip.AxZip). For licensing, the ASP/scripting approach should be used (placing the license in the registry of the machine running the app). The registry location of the license is:
Find what is in your development machine's registry, and add the same key to the deployment machine.
This is further outlined on the Distribution page of the help file, under the heading "Distribution Under IIS."

*3 You will also not be able to do this for our graphical controls (such as Vt). For these controls there are two options. The first is to use it on a form, and dynamically create and use the form (it would not be necessary to show the form). The second is to use the class (DartVt.VtClass) and add the license to the registry, as described above.

Reply | Licensing Issues Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX