Admin Production ni-theme
Current Publication

CA_ServerDllGetClassObject

LabWindows/CVI

CA_ServerDllGetClassObject

HRESULT CA_ServerDllGetClassObject (HINSTANCE serverHInstance, const CLSID *classId, const IID *interfaceId, void *interfacePtr);

Purpose

Implementation of the DllGetClassObject function used in the DLL ActiveX servers generated by the ActiveX Server Wizard. The COM runtime uses this function to create a class factory object. The class factory object is used to create COM objects. The COM runtime is the part of the operating system that provides COM services and performs COM-related tasks.

Parameters

Input
Name Type Description
serverHInstance HINSTANCE The HINSTANCE of your server.

Note that the HINSTANCE is passed in as an argument to DllMain and WinMain. If your code uses main instead of WinMain as the module entry point, this value is not available. Therefore, EXE servers must use WinMain as their entry point.
classId const CLSID * Class id of the class whose class object is requested.
interfaceId const IID * Interface id of the class object that is requested. Usually this value is IID_IClassFactory.
Output
Name Type Description
interfacePtr void * The interface pointer obtained from the class object (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