CA_GetInterfaceFromObjHandle
- Updated2023-02-21
- 2 minute(s) read
CA_GetInterfaceFromObjHandle
HRESULT CA_GetInterfaceFromObjHandle (CAObjHandle objectHandle, const IID *interfaceId, int forceAddRef, void *interfacePtr, int *didAddRef);
Purpose
Gets the interface pointer associated with a CAObjHandle for an ActiveX server object.
The type of the interface pointer returned depends on the interfaceId parameter. You can use the interface pointer to call members of the interface or pass it to Windows SDK functions.
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. |
interfaceId | const IID * | The interface id specifying the type of the interface pointer being requested. You must pass the UUID of an interface implemented by the object passed in the objecthandle parameter or zero to indicate the current interface id that is stored in that object handle. |
forceAddRef | int | Specify a nonzero value or select Yes in the function panel to always call the AddRef method of the object. The didAddRef output parameter always returns a non-zero value. Specify 0 or select No in the function panel to call the AddRef method of the object only when necessary. The didAddRef parameter indicates whether AddRef was called. |
Output | ||
Name | Type | Description |
interfacePtr | void * | The interface pointer associated with the ActiveX server object identified by the objectHandle parameter. The type of the interface pointer returned depends on the interfaceId parameter. |
didAddRef | int | A Boolean value indicating whether the function called the AddRef method of the object. If the value is non-zero, call Release when the interface pointer is no longer needed. You can pass NULL for this parameter if you do not need this information. |
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.5 and later