10-21-2005 12:31 PM
10-21-2005 05:30 PM
10-24-2005 12:39 PM
10-25-2005 12:52 PM
Here is a TestStand Sequence to show the concepts. In CVI, if you are creating the engine from scratch, you will need to call Engine.LoadTypePaletteFilesEx before you call GetTypePalleteList.
For the following property: PropertyObjectFile.Path, you can do this in CVI by:
TS_PropertyObjectFileSetPath (newFile, NULL, "c:\\test.ini");
To append the array, you will have to allocate a new array that is large enough to contain all of the elements, copy each element over, and append yours to the end of the list.
Hope this helps!
Allen P.
NI
10-25-2005 01:24 PM
Here is some very crude CVI code that does the same thing. I am not checking for memory leaks or other considerations, but it should show you the basic method that you will need to follow:
int error = 0;
int i = 0;
ERRORINFO errorInfo;
ErrMsg errMsg;
unsigned int numElems;
LPDISPATCH dispatchElem;
LPDISPATCH * newFileListAsHandle;
CAObjHandle * fileListAsHandle;
SAFEARRAY *fileList;
CAObjHandle engine, newFile;
errChk (TS_NewEngine ("", &engine));
tsErrChk (TS_EngineLoadTypePaletteFilesEx (engine, &errorInfo,
TS_ConflictHandler_Error, 0));
tsErrChk (TS_EngineNewPropertyObjectFile (engine, &errorInfo, 2,
&newFile));
tsErrChk (TS_PropertyObjectFileSetPath (newFile, &errorInfo, "c:\\test.ini"));
tsErrChk (TS_EngineGetTypePaletteFileList (engine, &errorInfo, &fileList));
errChk (CA_SafeArrayTo1DArrayEx (&fileList, CAVT_OBJHANDLE, 0,
&fileListAsHandle, &numElems));
newFileListAsHandle = malloc(sizeof(LPDISPATCH) * (numElems + 1));
for(i = 0; i < numElems; i++)
{
CA_GetDispatchFromObjHandle (fileListAsHandle[i], &dispatchElem);
newFileListAsHandle[i] = dispatchElem;
}
CA_GetDispatchFromObjHandle (newFile, &dispatchElem);
newFileListAsHandle[numElems] = dispatchElem;
errChk (CA_Array1DToSafeArray (newFileListAsHandle, CAVT_DISPATCH, numElems+1,
&fileList));
tsErrChk (TS_EngineSetTypePaletteFileList (engine, &errorInfo, fileList));
tsErrChk (TS_EngineUnloadTypePaletteFiles (engine, &errorInfo));
tsErrChk (TS_EngineLoadTypePaletteFilesEx (engine, &errorInfo,
TS_ConflictHandler_Error, 0));
tsErrChk (TS_EngineShutDown (engine, &errorInfo, VTRUE));
03-24-2015 10:50 AM
In case someone need an TestStand sequence, that programatically adds Type Palettes - check the attachment.