Admin Production ni-theme
Current Publication

CA_GetDispatchFromObjHandle

LabWindows/CVI

CA_GetDispatchFromObjHandle

HRESULT CA_GetDispatchFromObjHandle (CAObjHandle objectHandle, LPDISPATCH *dispatchPtr);

Purpose

Note    This function has been superseded by CA_GetInterfaceFromObjHandle. The new function takes additional parameters for interface id, force AddRef, and did AddRef (output). Calling this function is equivalent to passing the following values for those parameters.
Interface Id IID_IDispatch
Force AddRef 0
Did AddRef NULL
NI recommends that you replace calls to this function with calls to CA_GetInterfaceFromObjHandle. You must replace calls to CA_GetDispatchFromObjHandle if the objHandle that is passed to this function supports multithreading. Otherwise, CA_GetDispatchFromObjHandle fails when you pass to it an object handle that supports multithreading.

Obtains the Dispatch pointer associated with the CAObjHandle for an ActiveX server object. You can use the Dispatch pointer to call members of the server IDispatch interface, or you can pass the Dispatch pointer to Windows SDK functions.

CA_GetDispatchFromObjHandle does not call AddRef on the Dispatch pointer.

Parameters

Input
Name Type Description
objectHandle CAObjHandle An ActiveX Object handle returned by one of the object creation functions in this library or by an ActiveX server method.
Output
Name Type Description
dispatchPtr LPDISPATCH Dispatch pointer of the ActiveX server object that objHandle identifies.

Return Value

Name Type Description
status HRESULT A value indicating whether an error occurred. Negative error codes indicate function failure.

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 ActiveX servers and passed on to you by the LabWindows/CVI 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.

Additional Information

Library: ActiveX Library

Include file: cviauto.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later