04-09-2009 06:02 AM
I have CVI based DLL that displays a panel for operator entered values. I then store these in a StationGlobal structure. It seems that the actual ini file is not updated unless you complete the sequence. If terminate it, it does not get the latest memory version of the StationGlobals. I found the function TS_EngineCommitGlobalsToDisk and added the following function to my DLL which I then call after the panel has closed:
void CommitInformation (int promptOnSaveConflicts,
CAObjHandle seqContextCVI,
char *reportText,
short *errorOccurred,
long *errorCode,
char errorMsg [1024])
{
int error = 0;
ERRORINFO errorInfo;
ErrMsg errMsg = {'\0'};
tsErrChk (TS_EngineCommitGlobalsToDisk (seqContextCVI, &errorInfo, (VBOOL)promptOnSaveConflicts));
Error:
// If an error occurred, set the error flag to cause a run-time error in TestStand.
if (errorInfo.wCode < 0)
{
*errorOccurred = TRUE;
*errorCode = errorInfo.wCode;
sprintf (errorMsg,
"Source : %s\n"
"Description: %s\n",
errorInfo.source,
errorInfo.description);
}
}
Now when it runs "error" contains a massive negative number, but errorInfo does not contain any errors. The StationGlobals are also not saved. What am I doing wrong?
Solved! Go to Solution.
04-09-2009 08:18 AM
04-09-2009 10:01 AM
It looks like your problem was that you were passing a SequenceContext to an Engine method. You have to pass a handle to the Engine. If you don't have an Engine handle handy, you can always get it from the context.
In general, the name of a CVI function for a TestStand method is TS_<interface name><method name>, though in some cases the it might be abbreviated. As an example of abbreviation, TS_PropertyGetValBoolean is a method on the PropertyObject interface, there is no Property interface.