LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI and VI

Is it possible to use LabView VI in LabWindows/CVI
0 Kudos
Message 1 of 2
(3,064 Views)
Steph,

Its very easy to use. You don't even need LabView on the intended target platform, only the LVRTE Engine.

I have attached some code below to show you some of the commands available.

Basically all you do is build an ActiveX interface using CVI to the LV Interface.
You can do this by using the tool in CVI by selecting the LVRTE, or build a LV Application (such as some sort of Daemon), and then export the ActiveX controls when building the release version of the VI.
The CVI ActiveX module will provide you with a tool panel that will allow you to perform most of the functions available within LV.

Some code snippets:

CLI_New_Application (NULL, 0, LOCALE_NEUTRAL, 0, &hLV_App) - Starts a new copy of LV or obtains a reference to an already loaded instance.


LV_AppGetVIReference (hLV_App, &errorInfo, szPathAndTopLevelVI, NULL, VFALSE, &hVI_Ref[DDM_LV_VI_REF]) -> Gets a reference to a top level VI.

Executing the VI:

nt CLI_execVI (CAObjHandle hThisContext, LabVIEWObj_VIRef hVI_ref)
{

// EXTERNS

extern LV_APP_TYPE_t gLV_AppType;

extern ErrorInfoStruct gErrorInfo;

// Local Scope


ERRORINFO errorInfo;

HRESULT hresult;

int addedRef;

LPDISPATCH dispParam;

char *aszParamNames[1] = {PARAMETER_NAME};
VARIANT vParamNames;
VARIANT avParamData[1];
VARIANT vParamData;

mcrCheckCACall(CA_VariantSet1DArray (&vParamNames, CAVT_CSTRING, 1, aszParamNames))

mcrCheckCACall(CA_GetInterfaceFromObjHandle (hThisContext, 0, 1, &dispParam, &addedRef))

mcrCheckCACall(CA_VariantSetDispatch(&avParamData[0], dispParam))

mcrCheckCACall(CA_VariantSet1DArray (&vParamData, CAVT_VARIANT, 1, avParamData))

switch (gLV_AppType)
{
case LV_FDS:

mcrCheckCACall(LV_VirtualInstrCall (hVI_ref, &errorInfo, &vParamNames,&vParamData))

break;

case LV_RTE:

mcrCheckCACall(CLI_VirtualInstrumentCall (hVI_ref, &errorInfo, &vParamNames,&vParamData))


break;

default:
break;
}


Error:

return (gErrorInfo.iInternalErrorCode);
}

------------------

The above function allows us to execute a VI using the LabView RTE or the the Full Development System.
The most complicated part of using VI's is the passing of data between them using the variant types, but its quite simple once you get the hang of it.

If you have any more questions, just give me a shout via this list, or chris.a.wright@motorola.com

Regards

Chris
Message 2 of 2
(3,064 Views)