Admin Production ni-theme
Current Publication

CA_InvokeHelperV

LabWindows/CVI

CA_InvokeHelperV

HRESULT CA_InvokeHelperV (CAObjHandle objectHandle, ERRORINFO *errorInfo, int methodOrPropertyID, int operation, unsigned int returnType, void *returnValue, size_t parameterCount, unsigned int parameterTypes[], va_list parameterList);

Purpose

Note    This function has been superseded by CA_InvokeHelperVEx. The new function takes an additional parameter for interface id. Calling this function is equivalent to passing 0 for the interfaceId parameter.

Gets or sets the value of an ActiveX server property or invokes a method of an ActiveX server. Unlike CA_InvokeHelper, CA_InvokeHelperV accepts arguments to the server operation as a variable argument list.

Note    This function is used by the functions generated by the ActiveX Controller Wizard. It is not intended to be used directly.

Parameters

Input
Name Type Description
objectHandle CAObjHandle An ActiveX object handle returned in an output parameter of an ActiveX server's function or a function in the Creating ActiveX Objects class in this library.
methodOrPropertyID int ID of the method or property you call or access; located in the server type library.
operation int Type of operation you want the server to perform.

The operation parameter must be one of the values in the following table.

Defined Constant Type of Operation
DISPATCH_METHOD Invoke a method.
DISPATCH_PROPERTYGET Get a property value.
DISPATCH_PROPERTYPUT Set a property value.
DISPATCH_PROPERTYPUTREF Set a property value (pass a pointer to the value).
returnType unsigned int Type of the return value (if any).

The value you pass for returnType depends on the operation parameter as shown in the following table.

Operation Return Type
DISPATCH_METHOD Return type of the server function.
DISPATCH_PROPERTYGET Data type of the property.
DISPATCH_PROPERTYPUT Always CAVT_EMPTY.
DISPATCH_PROPERTYPUTREF Always CAVT_EMPTY.
For DISPATCH_METHOD and DISPATCH_PROPERTYGET, the returnType can be any of the fundamental data types for variants, safe arrays, and properties except CAVT_NULL.

You can use the CAVT_ARRAY modifier on all data types except CAVT_CSTRING and CAVT_OBJHANDLE. For parameters you pass by reference using DISPATCH_METHOD, you can use the CAVT_BYREFI, CAVT_BYREFO, or CAVT_BYREFIO modifier. For DISPATCH_PROPERTYPUTREF, you should add the CAVT_BYREFI modifier, but the ActiveX Library adds it for you if you forget.
parameterCount size_t Number of arguments you pass that follow parameterTypes.

The value you pass for parameterCount depends on the operation parameter as shown in the following table.

Operation Parameter Count
DISPATCH_METHOD Number of arguments to pass to the server function.
DISPATCH_PROPERTYGET 0
DISPATCH_PROPERTYPUT 1
DISPATCH_PROPERTYPUTREF 1
parameterTypes unsigned int [] Data types of each argument that follows this parameter.

The value you pass for parameterTypes depends on the operation parameter as shown in the following table.

Operation Parameter Types
DISPATCH_METHOD Array that contains the types of the arguments to the server function.
DISPATCH_PROPERTYGET NULL
DISPATCH_PROPERTYPUT Single-element array that contains the data type of the property.
DISPATCH_PROPERTYPUTREF Single-element array that contains the data type of the property.

The parameterTypes array can contain any of the fundamental data types for variants, safe arrays, and properties except CAVT_NULL or CAVT_EMPTY.

You can use the CAVT_ARRAY modifier on all data types except CAVT_CSTRING and CAVT_OBJHANDLE. For parameters you pass by reference using DISPATCH_METHOD, you can use the CAVT_BYREFI, CAVT_BYREFO, or CAVT_BYREFIO modifier. For DISPATCH_PROPERTYPUTREF, you should add the CAVT_BYREFI modifier, but the ActiveX Library adds it for you if you forget.
parameterList va_list The arguments to the ActiveX server operation passed as a variable argument list initialized with the va_start macro.

The number of arguments passed must match the count passed in the parameterCount parameter.

The values you pass for parameters depends on the operation parameter as shown in the following table.

Operation Parameters
DISPATCH_METHOD A list of arguments to the ActiveX server function.
DISPATCH_PROPERTYGET Do not pass any arguments.
DISPATCH_PROPERTYPUT A list containing the value you want to assign to the property.
DISPATCH_PROPERTYPUTREF A list containing the value you want to assign to the property.
Output
Name Type Description
errorInfo ERRORINFO When the ActiveX server method invoked by this function fails with the error code DISP_E_EXCEPTION, descriptive information about the error code is stored in this parameter. The descriptive information includes the error code, source, and description. The information also can include a help file and help file context.

When the ActiveX server method invoked by this function fails with the error codes DISP_E_PARAMNOTFOUND, DISP_E_TYPEMISMATCH, or E_INVALIDARG, the parameter position of the invalid argument can be stored in the errorParamPos member of this parameter.

This parameter can be NULL.
returnValue void * The value (if any) the server method or property function returns.

The value CA_InvokeHelper returns in returnValue depends on the operation parameter as shown in the following table.

Operation Return Value
DISPATCH_METHOD Value the server function returns. Pass a pointer to a variable of the data type returnType specifies.
DISPATCH_PROPERTYGET Value of the property. Pass a pointer to a variable of the data type returnType specifies.
DISPATCH_PROPERTYPUT None. Always pass NULL.
DISPATCH_PROPERTYPUTREF None. Always pass NULL.

Return Value

Name Type Description
status HRESULT A value indicating whether an error occurred. Function failure is indicated by a negative error code.

Error codes are defined in CVIversion\include\cviauto.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h.

You can use CA_GetAutomationErrorString to get the description of an error code or CA_DisplayErrorInfo to display the description of the error code. If the error code is DISP_E_EXCEPTION (0x80020009 or -2147352567), then the errorInfo parameter contains additional error information. You can use CA_DisplayErrorInfo to display the error information.

Additional Information

Library: ActiveX Library

Include file: cviauto.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later