NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

'Lost ActiveX connection to CVI' error

Hi,
I began to use TS3.0+CVI7.0 after being used to TS2.0+CVI5.5.

I tried to use, for the first time, the new module call format, and I must have done some very basic mistake.

While in debug mode, I get the above error upon exiting the procedure.

Here is the procedure called:
void __declspec(dllexport) PowerUP(CAObjHandle seqContextCVI, long *result,
char reportText[1024], short *errorOccurred, long *errorCode, char errorMsg[1024])
{
int error = 0;
ErrMsg errMsg = {'\0'};
ERRORINFO errorInfo;

// char *lastUserName = NULL;
Boolean success = TRUE;
char *StepTitle = {'\0'}, NextErrMsg[BUFFER_LEN] = {'\0'}, buf[128];


StepTitle = "Begin Power Test";
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
EndOfTest:
// FREE RESOURCES
// if (lastUserName != NULL)
// CA_FreeMemory(lastUserName);

/* Error Handling */
if (error != 0 ) {
success = FALSE;
Fmt(buf,"%s<****ERROR: %s",StepTitle); //how do I put > in the string?
errChk(mstr_WriteToLog (seqContextCVI, buf, 2, 2, NextErrMsg));
}

/* Set up values for TS */
if (success)
*result = PASS;
else {
*result = FAIL;
strcpy(reportText, StepTitle);
}
Error:
/* for run-time error*/
if (error != 0) {
if (*NextErrMsg != '\0')
sprintf(errMsg,"PowerUP - %s / %s",StepTitle, NextErrMsg);
else
sprintf(errMsg,"PowerUP - %s",StepTitle);
*errorOccurred = TRUE;
*errorCode = error;
errorMsg =
strcpy(errorMsg, errMsg);
}

} //PowerUP


What is the error?

Thanks
Rafi
0 Kudos
Message 1 of 4
(3,210 Views)
Rafi,

I tried running your code and it works fine for me. The only difference was that you have a function called mstr_WriteToLog that I didn't have the code for. Since that was the only change that I made to the code, I'd recommend double checking that function for any errors. I've also attached the sequence with the cvi step so you can see if there is a problem in how you are calling your CVI DLL.

Another suggestion would be to make sure you aren't closing TestStand while your CVI DLL is still executing. Lastly, the function call of mstr_WriteToLog accepts the sequence context as a parameter (seqContextCVI). I'm not sure what you are doing in that function, but it seems a little odd to write the sequenceContext to a log. If you are trying to print
that, you might be getting an error there. Again, that's just a wild guess, so I'd suggest further debugging. If you can't make any more progress, please let us know the exact error message that you get as well as any error number.

Good luck!
Shannon R
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,210 Views)
Hi Shannon and thanks a lot.

My problem was a differance in the parameters order between the TS and the CVI procedure. It happened because I add a parameter after the function was created and didn't put in in the same position.

Regarding your comment of why I'm using the context as a parmaeter in the function mstr_WriteToLog is because that functions uses parameters from the TS station globals. Is there another way to do it? (that functions resides in a different dll).

Thanks
Rafi
0 Kudos
Message 3 of 4
(3,210 Views)
Rafi,

I'm glad you were able to figure out what was going wrong. As for passing the sequence context, there shouldn't be a problem passing the sequence context as a parameter to a DLL. I wasn't sure if that function was writing the value of the sequence context to the log or what it was doing. Since your code worked for me, and since that was the only part that I couldn't see, I thought that function call had high potential for error. If you wanted, you could always get the values of the Station Globals and pass those to your function rather than passing the sequence context reference to TestStand. Either way would work just fine.

Good luck with your project!

Shannon R
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,210 Views)