Admin Production ni-theme
Current Publication

CA_ServerInvoke

LabWindows/CVI

CA_ServerInvoke

HRESULT CA_ServerInvoke (IDispatch *thisInterfacePtr, int memberId, const IID *interfaceId, LCID locale, unsigned short flags, DISPPARAMS *dispParams, VARIANT *result, EXCEPINFO *exceptionInfo, unsigned int *argumentErrorIndex);

Purpose

Implementation of the IDispatch::Invoke method used in the ActiveX servers generated by the ActiveX Server Wizard.

Parameters

Input
Name Type Description
thisInterfacePtr IDispatch * The IDispatch interface pointer of your ActiveX object.
memberId int Id of the member to call Invoke on.
interfaceId const IID * Reserved for future use. Must be IID_NULL.
locale LCID The locale identifier for the type information.
flags unsigned short Flags describing the context of the Invoke call. You can use the following flags:

DISPATCH_METHOD: The member is invoked as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag can be set.
DISPATCH_PROPERTYGET: The member is retrieved as a property or data member. DISPATCH_PROPERTYPUT: The member is changed as a property or data member. DISPATCH_PROPERTYPUTREF: The member is changed by a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a reference to an object.
dispParams DISPPARAMS * Pointer to a structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.
Output
Name Type Description
result VARIANT The result of the Invoke call, or NULL if the caller expects no result.

This parameter is ignored if you specify DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF.
exceptionInfo EXCEPINFO The exception information for the Invoke call.

This structure is filled in if DISP_E_EXCEPTION is returned. Pass NULL if this information is not required.
argumentErrorIndex unsigned int The index of the first argument that has an error.

Arguments are stored in Disp_Params->rgvarg in reverse order, so the first argument is the one with the highest index in the array (here, Disp_Params is the variable passed in the dispParams parameter). Pass NULL if you do not want this information.

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. The LabWindows/CVI ActiveX Library explicitly returns error codes. Other error codes in winerror.h are generated by the COM runtime and passed on to you by the ActiveX Library.

You can use CA_GetAutomationErrorString to get the description of an error code or CA_DisplayErrorInfo to display the description of the error code.

Note   You should not return the ActiveX Library error codes from your ActiveX server to your ActiveX clients, unless you document them in your server documentation. An acceptable compromise in this case is to return E_UNEXPECTED to the clients.

The error codes defined in <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h are too numerous to display here. These error codes can be returned to your ActiveX clients.

Additional Information

Library: ActiveX Library

Include file: cviauto.h

LabWindows/CVI compatibility: LabWindows/CVI 6.0 and later