10-27-2015 04:51 AM
The following code for a timed confirmpopup used to work as code module in Teststand-3.1/Windows XP. When porting this to Teststand-2013/Windows-7 it doesn't work anymore. The faked keystroke seems to go to nirvana and doesn't reach the confirm popup. How to get this working again ?
int CVICALLBACK waitcallback (int reserved, int theTimerId, int event,
void *callbackData, int eventData1,
int eventData2)
{
if (event != EVENT_TIMER_TICK) return 0;
// Time elapsed: send ESC to the active panel
FakeKeystroke (VAL_ESC_VKEY);
return 0;
}
void __declspec(dllexport) fl_query_repair(tTestData * testData, tTestError * testError)
{
ErrMsg errMsg = {'\0'};
ERRORINFO errorInfo;
double waittime = 5;
int timer,response,status,error = 0;
char msgstr1[1024]= {0},resstr[256];
timer = NewAsyncTimer (waittime, 1, 1, waitcallback, 0);
response = ConfirmPopup ("Repair", "Is this a repair ?");
if (response) strcpy ( resstr, "Repair") ;
else strcpy ( resstr, "Serial Prod");
status = TS_PropertySetValString (testData->seqContextCVI, &errorInfo,
"Step.Limits.String ", 0, resstr);
testData->replaceStringFuncPtr(&testData->stringMeasurement,resstr);
Error:
// If an error occurred, set the error flag to cause a run-time error in TestStand.
if (error < 0)
{
testError->errorFlag = TRUE;
//OPTIONALLY SET THE ERROR CODE AND STRING
testError->errorCode = error;
testData->replaceStringFuncPtr(&testError->errorMessage, errMsg);
}
return;
}
11-04-2015 04:43 AM
I can't comment on your code as I haven't tested it, but in case you can't get it to work, you can use the method described here to make your own timed confirm popup (just add a normal timer to a simplification of one of the examples): http://www.gdargaud.net/Hack/LabWindows.html#Popup