Clear Filters
Clear Filters

Why are none of the properties or methods available from my ActiveX Server COM object?

8 views (last 30 days)
I am using an ActiveX COM object that I have created using the following syntax:
h = actxserver('myProgId')
Even though MATLAB has returned a handle to the COM object and started the server application, MATLAB will return an empty set of properties and methods when I issue the following commands:
get(h)
methodsview(h)
methods(h)
invoke(h)
Also, when trying to invoke a method that is absent in this view, I may get the following error. ERROR: I get the following prototype: ??? Error: Type mismatch, argument 3

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Nov 2016
There are several possible explanations as to why a COM object would return an empty set of properties and/or methods. Three of the reasons are:
1. The COM object does not have any properties or methods available to it.
2. MATLAB cannot find the COM object's type library.
Frequently, the type library is part of the COM object. If the type library is instead contained in a separate file, MATLAB is not able to find the type library to query it for the supported methods and properties.
This is a current limitation of MATLAB that we are looking to address for a future release of MATLAB. Currently, if you know the names of the methods and properties, you can access them explicitly using GET, SET, and INVOKE. For example
myValue = get(myObject,'myProperty')
set(myObject,myProperty,'myValue')
invoke(myObject,'myMethod')
Using dot notation (e.g., myObject.myMethod) will not work.
For more information on GET, SET, and INVOKE, issue the following commands at the MATLAB command prompt:
doc get
doc set
doc invoke
3. The COM object has not been defined properly for invocation via late-binding. This may be the cause if you or a colleague has created a custom COM object (especially in C++). One thing to keep in mind is that you need to fully implement the IDispatch interface. MATLAB uses late-binding to call COM objects, so you should test your application in another language, such as Visual Basic using late-binding. As of MATLAB 7.4 (R2007a), the IUnknown interface is also supported. For more information see:

More Answers (0)

Products


Release

R14SP1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!