06-07-2012 02:32 AM
Solved! Go to Solution.
06-08-2012 10:52 AM
You do not need a module to get a list of DLL functions. Here's some pseudocode for what you need to do:
CommonCAdapter adapter = Engine.GetAdapterByKeyName(AdapterKeyNames.FlexCVIAdapterKeyName);
DllFunctions functions = adapter.GetDllFunctions(path);
for (int i = 0; i < functions.Count; i++)
{
DllFunction function = functions[i];
string functionName = function.DisplayName;
// Do something with functionName.
}
06-11-2012 03:16 AM
Hi Eric,
Thank you for your answer. I was created similar code in CVI with addition that function parameters (if exist) will be writen in txt file. However, number of parameters, for some reason are bigger for one. If function has only two parameters (testData and testError), still anwer is 3. Here is code for this:
error = TS_EngineGetAdapterByKeyName (EngineHandle, &errorInfo, "C/CVI Flexible Prototype Adapter", &commonCAdapter); error= TS_CommonCAdapterGetDllFunctions (commonCAdapter, &errorInfo, sztemp, &dll_func); error = TS_DllFunctionsGetCount (dll_func, &errorInfo, &count); max=count; status=0; i=0; count1=0; while (max>0){ CA_VariantSetInt(&itemIndex,status); error = TS_DllFunctionsGetItem (dll_func, &errorInfo, itemIndex, &dll_func1); error = TS_DllFunctionGetDisplayName (dll_func1, &errorInfo, &szStepID); error = TS_DllFunctionGetHasParameterInformation (dll_func1, &errorInfo, &removedfromCache); sprintf(buffer,"%s :\n",szStepID); error = WriteStringToFile (FILE_dll, buffer); error = TS_CommonCModuleSetFunctionName (commonCModule, &errorInfo,szStepID); error = TS_ModuleLoadPrototype (commonCModule, &errorInfo, NULL, &removedfromCache); error = TS_CVIModuleGetParameters (cviModule, &errorInfo, &cviParameters); error = TS_CVIParametersGetCount (cviParameters, &errorInfo, &count1); for (i=1;i<count1;i++) { CA_VariantSetInt(&itemIndex,i); error= TS_CVIParametersGetItem (cviParameters, &errorInfo, itemIndex, &cviParameter); error = TS_CVIParameterAsCommonCParameter (cviParameter, &errorInfo, &commonCParameter); error = TS_CommonCParameterGetParameterName (commonCParameter, &errorInfo, &szparam_name); error = TS_CommonCParameterGetDescription (commonCParameter, &errorInfo, &szparam_desc); sprintf(buffer,"%s, %s\n",szparam_name,szparam_desc); error = WriteStringToFile (FILE_dll, buffer); CAFREEOBJ (cviParameter); CAFREEOBJ (commonCParameter); } count1=0; status++; max--; }
best regards,
branar
06-11-2012 08:39 AM
TestStand treats the function return value as a parameter so the collection of CVIParameters will always contain one more item than the number of function parameters. The return value is the first item in the CVIParameters collection.
06-12-2012 12:55 AM
Hi Eric,
Thank you for your clarifications.
best regards,
branar