Main Content

Package a Deployable COM Component

Add-In and COM Component Registration

Note

COM components are used in both MATLAB® Compiler™ and MATLAB Compiler SDK™, therefore some of the instructions relating to building and packaging COM components and add-ins can be shared between products.

When you create your COM component, it is registered in either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER, based on your log-in privileges.

If you find you need to change your run-time permissions due to security standards imposed by Microsoft® or your installation, you can do one of the following before deploying your COM component or add-in:

  • Log on as administrator before running your COM component or add-in

  • Run the following mwregsvr command prior to running your COM component or add-in, as follows:

    mwregsvr [/u] [/s] [/useronly] project_name.dll 
    where:

    • /u allows any user to unregister a COM component or add-in for this server

    • /s runs this command silently, generating no messages. This is helpful for use in silent installations.

    • /useronly allows only the currently logged-in user to run the COM component or add-in on this server

Caution

If your COM component is registered in the USER hive, it will not be visible to Windows Vista™ or Windows® 7 users running as administrator on systems with UAC (User Access Control) enabled.

If you register a component to the USER hive under Windows 7 or Windows Vista, your COM component may fail to load when running with elevated (administrator) privileges.

If this occurs, do the following to re-register the component to the LOCAL MACHINE hive:

  1. Unregister the component with this command:

    mwregsvr /u /useronly my_dll.dll
    

  2. Reregister the component to the LOCAL MACHINE hive with this command:

    mwregsvr my_dll.dll