This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Deploy ActiveX Controls Requiring Run-Time Licenses

When you deploy a Microsoft® ActiveX® control that requires a run-time license, include a license key, which the control reads at run time. If the key matches the license key version of the control, an instance of the control is created. To deploy a run-time-licensed control with a MATLAB® application, use the following procedure.

Create Function to Build Control

Create a function, buildcontrol.m, to build the control. The file must contain two elements:

  • The pragma %#function actxlicense. This pragma causes the MATLAB Compiler™ to embed a function named actxlicense into the standalone executable file you build.

  • A call to actxcontrol to create an instance of the control.

Place this file in a folder outside of the MATLAB code tree.

Here is an example file:

function buildcontrol
%#function actxlicense
h=actxcontrol('MFCCONTROL2.MFCControl2Ctrl.1',[10 10 200 200]);

Build Control and License File

Change to the folder where you placed the function you created to build the control. Call the function. When it executes this function, MATLAB determines whether the control requires a run-time license. If it does, MATLAB creates another file, named actxlicense.m, in the current working folder. The actxlicense function defined in this file provides the license key to MATLAB at run time.

Build Executable

Call the MATLAB Compiler build function to create the standalone executable from the file you created to build the control. The executable contains both the function that builds the control and the actxlicense function.

mcc -m buildcontrol

Deploy Files

Distribute buildcontrol.exe, buildcontrol.ctf, and the control (.ocx or .dll).

See Also

Was this topic helpful?