Initialize Method  
 

Initialize the control and validate the runtime license key.

Syntax

object.Initialize( [LicenseKey] )

Parameters

LicenseKey
An optional string value which specifies a runtime license key used to initialize the control. If the license key is omitted or passed as an empty string, a development license must be installed on the local system.

Return Value

A value of zero is returned if the control was initialized successfully. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

This method dynamically loads other system libraries and allocates thread local storage. In most cases, it is not necessary to call this method directly because it is automatically invoked when an instance of the control is created by the container. However, if the control is created dynamically using CreateObject or a similar method, this must be the first method that is called before you attempt to modify any property values or invoke other methods. Failure to initialize the control may result in in subsequent errors and/or cause an exception to be raised.

Each time the Initialize method is invoked, it increments an internal counter that keeps track of the number of times that it has been called by any thread in the current process. The Uninitialize method decrements this counter, and when the usage count drops to zero, the control will automatically unload the system libraries that it has dynamically loaded and will destroy the process heap that was allocated when the first instance of the control was created.

If the control is being used within another DLL, it is important that you do not attempt to create an instance of the control or call the Initialize method from within the DllMain function because it can result in deadlocks or access violation errors. If the DLL is written in C++ and it is linked with the C runtime library (CRT), it will automatically call the constructors and destructors for any static and global C++ objects and has the same restrictions.

Example

Set icmpClient = CreateObject("SocketTools.IcmpClient.11")

nError = icmpClient.Initialize(strLicenseKey) 
If nError > 0 Then
    MsgBox "Unable to initialize SocketTools component"
    End
End If

See Also

IsInitialized Property, Uninitialize Method