Package com.ms.com |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
public interface ILicenseMgr { // Methods public Object createInstance(String clsid, Object punkOuter, ComContext clsctx) throws ComException; public Object createWithLic(String lic, String clsid, Object punkOuter, ComContext clsctx) throws ComException; }
The ILicenseMgr interface allows you to use licensed COM components or controls from your Java application.
A licensed control cannot be instantiated except by legal users. A design-time license allows a developer to embed the control in his or her applications. When the developer distributes the application, a run-time license allows the control to be instantiated when the end-user runs the application.
An HTML page containing licensed controls must have an associated license package (.LPK) file, which stores the run-time licenses for the controls. Use the License Package Authoring Tool (LPK_TOOL.EXE), included with the ActiveX SDK, to create an .LPK file. For full information on the ActiveX licensing scheme, see the ActiveX SDK.
To use ILicenseMgr with a licensed control, call the createWithLic method and specify the license string explicitly to create an instance of the control.
An example of a licensed component is the _DBEngine component in Data Access Objects (DAO); you must use ILicenseMgr when using DAO.
See also LicenseMgr, ComContext, and package com.ms.com.
public Object createInstance( String clsid, Object punkOuter, ComContext ctxFlags ) throws ComException;Creates an instance of the specified COM class.
Parameter Description clsid The CLSID of the COM class you want to instantiate, specified in string form (for example, "{00025E15-0000-0000-C000-000000000046}"). punkOuter If the object is being created as part of an aggregate, this parameter specifies the aggregating object. Otherwise, you can simply pass null for this parameter. ctxFlags A ComContext value representing the context in which the new object should be created. Remarks:
Warning In general, you should not call this method. The appropriate means of creating an instance of a COM class is to use the new operator on the Java wrapper generated by the Java Type Library Wizard (or JavaTLB). This method should be called only in special situations, and only if you are familiar with low-level COM programming.
Throws:
ComFailException if there was an error.
See Also: ILicenseMgr, ComContext
public Object createWithLic(String lic, String clsid, Object punkOuter, ComContext ctxFlags ) throws ComException;Creates a new instance of the specified licensed COM class.
Parameter Description lic The license for the COM class you want to instantiate. clsid The CLSID of the COM class you want to instantiate, specified in string form (for example, "{00025E15-0000-0000-C000-000000000046}"). punkOuter If the object is being created as part of an aggregate, this parameter specifies the aggregating object. Otherwise, you can simply pass null for this parameter. ctxFlags A ComContext value representing the context in which the new object should be created.. Throws:
ComFailException if there was an error.
Example:
The following is a helper class with single method, create, that wraps a call to CreateWithLic. By using this method, you can create an instance of a specific licensed component without having to specify the license or the CLSID every time.
import dao3032.*; import com.ms.com.*; public class dao_dbengine { static public _DBEngine create() { _DBEngine result; ILicenseMgr mgr = new LicenseMgr(); result = (_DBEngine) mgr.createWithLic( "mjgcqcejfchcijecpdhckcdjqigdejfccjri", // BSTR lic "{00025E15-0000-0000-C000-000000000046}", // BSTR clsid null, // IUnknown* punkOuter ComContext.INPROC_SERVER // ComContext ctxFlags ); return result; } }See Also: ILicenseMgr, ComContext