LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

ActiveApp

ActiveApp

LabWindows/CVI ActiveX Server Interface

CVI_ActiveApp (const char *server, int supportMultithreading, LCID locale, int reserved, CAObjHandle *objectHandle);


Note  This function signature is shown as it appears when you create a client using the LabWindows/CVI ActiveX Controller Wizard. If you create a client for the LabWindows/CVI ActiveX server interface using a different development environment, this function might be exposed differently. Some of the parameters documented here, such as objectHandle or errorInfo, are not applicable if you write a client using a different development environment.

Purpose

Gets a handle to an active Application object.

If the server application is already running, this function may or may not start another copy of the application. This is determined by the server application.

You must call CA_InitActiveXThreadStyleForCurrentThread with COINIT_APARTMENTTHREADED if you register any ActiveX event callbacks and want the callbacks to be called from the same thread in which they were registered. If you do not call CA_InitActiveXThreadStyleForCurrentThread with COINIT_APARTMENTTHREADED your callbacks will be called from a system thread.

Parameters

Input
Name Type Description
server const char * The name or IP address of the machine on which you want to run the ActiveX server. The name can be either a UNC name ("\playdough") or DNS name ("plato.natinst.com").

If you pass NULL for this parameter and there is a RemoteServerName registry entry for this server, the server runs on the machine specified by the RemoteServerName entry.

If you pass NULL for this parameter and there is no RemoteServerName registry entry for this server, the server runs on the same machine as your program.
supportMultithreading int Pass 0 if you use the object only from the thread that calls this function. Pass 1 if you use the object from multiple threads.

The LabWindows/CVI ActiveX library uses the COM Global Interface Table (GIT) to marshal interface pointers between threads. There is overhead associated with using the GIT that you should avoid when possible, therefore if you do not pass the CAObjHandle between threads in your application, you do not need to use the GIT.
locale LCID Pass the locale for the object. This value tells the object how to interpret arguments to its methods. Pass LOCALE_NEUTRAL to indicate the default language-neutral locale. This value is not used by the server when you call it through a dual interface method.

The LabWindows/CVI ActiveX Library passes this value to the IDispatch::Invoke method.
reserved int This parameter is reserved. You must pass 0 for this parameter.
Output
Name Type Description
objectHandle CAObjHandle A handle to the requested ActiveX object.

Use this handle to call methods and get/set properties of this ActiveX object.

When it is no longer needed, you must discard this handle using CA_DiscardObjHandle.

Return Value

Name Type Description
status HRESULT A value indicating whether an error occurred. A negative error code indicates function failure.

Error codes are defined in CVIversion\include\cviauto.h and <Program Files>\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\winerror.h.

You can use CA_GetAutomationErrorString to get the description of an ActiveX Library error code.
Was this information helpful?