This method of the ILicenseMgr Interface creates a new instance of a licensed COM class.
public IUnknown createWithLic(String lic, String clsid, IUnknown punkOuter, int ctxFlags);
Returns a new instance of the specified licensed COM class.
lic | The license for the COM class that is instantiated. |
clsid | The class identifier (CLSID) of the instantiated COM class. |
punkOuter | The aggregating object if the object is being created as part of an aggregate; otherwise, null. |
ctxFlags | The value that represents the context that the new object is created in. |
You can create an instance of the _DBEngine licensed component without having to specify the license or the class identifier (CLSID). The following example shows a helper class with a single method called create that wraps a call to createWithLic:
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,ComContext.INPROC_SERVER); // IUnknown* punkOuter, // ComContext ctxFlags return result; } }
com.ms.com.ComFailException if there is an error instantiating the class.