ArcObjects Library Reference  (Controls)    

LicenseControl CoClass

ESRI LicenseControl

Product Availability

Available with ArcGIS Engine.

Description

Use the LicenseControl to initialize each application with a suitable license(s) in order for it to run successfully on any machine it is deployed on to. The LicenseControl will configure the licenses at application start time when the form or dialog containing the LicenseControl is loaded.

All applications need to be configured with a license except when the application is not a stand-alone executable i.e. if it's a dll that will be incorporated into an application that will itself perform the license configuration.

There are two types of license to consider when initializing an application, product licenses and extension licenses if an application uses any of the ArcGIS extensions. These licenses can be Engine Single Use, Desktop Single Use or Desktop Concurrent licenses.

Once an application has been initialized with a license it cannot be re-initialized (with a new license); an application is initialized with a license for the duration of its life. When initializing an application with a license the following must be considered:

Use the LicenseControl to automatically perform license initialization within simple graphical user interface applications using the ArcGIS MapControl, PageLayoutControl, TOCControl, ToolbarControl, SymbologyControl, SceneControl or GlobeControl. If greater control is required over license initialization, particularly when checking out and in extension licenses (the LicenseControl will check out extension licenses for the duration of an application's life) use the AoInitialize object to programmatically perform license initialization.  

Using the LicenseControl in an application that programmatically initializes a product license is not recommended, because the LicenseControl may initialize a product license before the initialization code executes. However, the LicenseControl can be used to initialize an application with a product license, and any required extension licenses can be checked out and in programmatically.

Use the License Property Page to select the product licenses the application can be initialized with, select the extension licenses required by the application and to set whether the application is shutdown automatically if license initialization fails. 

Products

Select at least one product license the application can be initialized with. By default the LicenseControl will try to initialize the application with the ArcGIS Engine product license.

If the product you require is not licensed you may optionally initialize the application with a higher product license. For example, if you select the ArcGIS Engine license and the ArcView license, the LicenseControl will initially try to initialize the application with an ArcGIS Engine license (the lower license). If that license is not available the LicenseControl will try to initialize the application with an ArcView license (the next higher level license selected). If no product licenses are available then the application will fail to initialize. Note, that once an application is initialized with a product license it is not possible to re-initialize the application for the duration of the applications life.

Extensions

Select the extension licenses required by the application. Not every extension license is available with every product license, as such the list of available extension licenses will change as different product licenses become selected. If the ArcGIS Engine product license is selected and an ArcGIS Desktop product is selected, only the ArcGIS Engine extension licenses will display.

The availability of each extension license is checked in conjunction with the product license that the application will ultimately be initialized with. If any of the selected extensions are not available the application will fail to initialize. The LicenseControl will check out extensions directly after the application is initialized and will check in extensions when the application is shutdown. 

If a SceneControl or GlobeControl (requiring the 3D Analyst extension) is embedded within the same container as the LicenseControl, the 3D Analyst extension will automatically be checked.

Shutdown

Set whether the LicenseControl will automatically shut down the application if license initialization fails. If the LicenseControl handles license initialization failure a 'License Failure' dialog box will be displayed to the user before the application is shutdown. If the developer handles license initialization failure the ILicenseControl interface members can be used to obtain information on the nature of the failure before the application is programmatically shut down.

Extended Error Information

Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.

Interfaces

Interfaces Description
ILicenseControl Provides access to members that control the LicenseControl.
ILicenseControlDefault Provides access to members that control the LicenseControl.
IPersist Defines the single method GetClassID, which is designed to supply the CLSID of an object that can be stored persistently in the system. IPersist is the base interface for three other interfaces: IPersistStorage, IPersistStream, and IPersistFile.
IPersistStreamInit Supports initialized stream-based persistence, regardless of whatever else the object does.
ISupportErrorInfo Indicates whether a specific interface can return Automation error objects.
[Visual Basic 6.0]

1. Explicit component license initialization is not required when working in the VBA environment in ArcGIS Desktop (ArcMap, ArcCatalog, ArcGlobe, ArcScene) as this is performed automatically when the application starts.

2. To create a LicenseControl programmatically use the following code:

Dim pLicenseControl As esriControls.ILicenseControl 
Set pLicenseControl = CreateObject("esriControls.LicenseControl")