Admin Production ni-theme
Current Publication

CA_ServerCreateObject

LabWindows/CVI

CA_ServerCreateObject

HRESULT CA_ServerCreateObject (const CLSID *classId, IUnknown *outerIUnknown, const IID *interfaceId, void *interfacePointer);

Purpose

Creates an ActiveX object programmatically.

Top-level objects are created by the COM runtime, when requested by your ActiveX clients, and typically should not be created using this function.

Parameters

Input
Name Type Description
classId const CLSID * The class id of the ActiveX server object to be created.
outerIUnknown IUnknown * Pass NULL if the object is not being created as part of an aggregate. If not, pass the pointer to the aggregating object's IUnknown interface (the outer object's IUnknown).
interfaceId const IID * The interface id specifying the type of the interface pointer that is requested from the object.
Output
Name Type Description
interfacePointer void * The interface pointer from the created object.

This interface pointer should be of the type passed in the interfaceId parameter.

Pass the address of an interface pointer variable of the required interface type.

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