Admin Production ni-theme
Current Publication

CA_LoadObjectFromFile

LabWindows/CVI

CA_LoadObjectFromFile

HRESULT CA_LoadObjectFromFile (const char *filename, const char *serverMachineName, CAObjHandle *objectHandle);

Purpose

Note    This function has been superseded by CA_LoadObjectFromFileEx. The new function takes additional parameters for interface id, support multithreading, locale, and reserved. Calling this function is equivalent to passing the following values for those parameters.
Interface Id IID_IDispatch
Support Multithreading 0
Locale LOCALE_NEUTRAL
Reserved 0

Creates an ActiveX server object and initializes it using data that CA_LoadObjectFromFile reads from a file.

The extension portion of the filename parameter identifies the ActiveX server to use. The contents of the file identify the type of object to create and its initial data.

Parameters

Input
Name Type Description
filename const char * Pathname of file that contains the type of object to create and its initial data. The extension indicates the ActiveX server to use.
serverMachineName const char * Name or IP address of the computer on which you want to run the ActiveX server.

serverMachineName can be either a UNC name ("\\server") or a DNS name ("home.server.com").

If you pass NULL for this parameter and there is an ActivateAtStorage registry entry for this server, the server runs on the machine on which the file specified by the filename parameter resides.

If you pass NULL for this parameter and there is no ActivateAtStorage registry entry for this server, the server runs on the same machine as your program.
Output
Name Type Description
objectHandle CAObjHandle Handle to the requested ActiveX object.

You can pass objHandle to other functions in this library to call methods of the ActiveX object or to get and set properties of the ActiveX object. When you no longer need objHandle, discard it by calling CA_DiscardObjHandle.

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