_ObjectCallMethod
Calls a specific method for an ActiveX object. (See the documentation for your ActiveX object for details on methods and properties.)
Note: The parameter list passed to the control can only have Cicode variables or variable tags; it cannot use values returned directly from a function because an ActiveX control may modify parameters passed to it.
For example:
//Calculate a value and pass to ActiveX control
_ObjectCallMethod(hControl, "DoSomething" CalcValue());
is not allowed because the return value of a function cannot be modified. The following should be used instead:
INT nMyValue;
//Calculate Value
nMyValue = CalcValue();
//Pass Value to ActiveX control
_ObjectCallMethod(hControl, "DoSomething" nMyValue);
Syntax
_ObjectCallMethod(hObject, sMethod, vParameters)
hObject:
The handle for the object (as returned by the ObjectByName() function).
sMethod:
The name of the method.
vParameters:
A variable length parameter list of method arguments. The variables will be passed however you enter them, and will then be coerced into appropriate automation types. Likewise, any values modified by the automation call will be written back - with appropriate coercion - into the passed Cicode variable.
Return Value
The return value from the method - if successful, otherwise an error is returned.
Related Functions
ObjectByName, DspAnCreateControlObject, CreateObject, CreateControlObject
Example
See CreateControlObject.
See Also