LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CA_Array1DToSafeArray does not support elements of type CAVT_OBJHANDLE

I need to create a safe array containing object handles, which should be supported since the TestStand API function TS_EngineGetTypePaletteFileList returns such an array in CVI. However I cannot use the CA_Array1DToSafeArray to convert a C-style array to a safe array of that time. The documentation points out that this function does not support arrays containing object handles.
 
- Are there functions to operate directly on a safe array? I need to be able to set the number of elements (insert elements) and assign them.
- If not do I need to first store the safe array in a variant and then operate on the variant?
 
Ultimately I need to be able to create a safe array containing object handles to pass to the TestStand API function TS_EngineSetTypePaletteFileList to programmatically load type palette files in TestStand.
 
Thanks
0 Kudos
Message 1 of 2
(2,974 Views)
Safearrays cannot contain CVI ActiveX object handles - safearray is a Microsoft datastructure and has no knowledge of CVI object handles. But safearrays can contain IUnknown and IDispatch pointers and CVI ActiveX library functions (CA_SafeArrayTo1DArrayEx, etc) convert these interface pointers to CVI object handles when converting from safearray to C array. I do not know about the TestStand API functions, but I would expect that they use safearrays containing IDispatch (or IUnknown) pointers. So to pass ActiveX objects in a safearray to the TestStand function, you should first get the IDispatch (or IUnknown) pointers from the CVI object handles using CA_GetInterfaceFromObjHandle, and then create a safearray containing these interface pointers using CA_Array1DToSafeArray.
0 Kudos
Message 2 of 2
(2,961 Views)