Below is part of my codes:
UINT ThermocoupleReadTemp(LPVOID pParam)
{
P3Dlg* pDlg = (P3Dlg*)pParam;
double AcquireRate;
int NumOfScan;
COleVariant upper = 0.01;
COleVariant lower = -0.01;
COleVariant vOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR);
CString channels;
CString temp;
pDlg->measureCJTemp();
temp.Format("CJTemp = %f",double(pDlg->getCJTemp()));
AfxMessageBox(temp, MB_OK | MB_ICONERROR);
AcquireRate = double(pDlg->getThermocoupleRate());
NumOfScan = 3;
pDlg->findMinMaxCh();
channels.Format("ob0!sc1!md1!%d:%d",pDlg->getMinCh(),pDlg->getMaxCh());
pDlg->getCWAI()->SetDevice(1);
pDlg->getCWAI()->GetChannels().Remo
veAll();
pDlg->getCWAI()->GetChannels().Add(channels,upper,lower,vOptional,vOptional);
//this SetNScans cause the graph to stop when dragging the window
pDlg->getCWAI()->SetNScans(NumOfScan);
pDlg->getCWAI()->GetScanClock().SetFrequency(AcquireRate * NumOfScan);
pDlg->getCWAI()->GetStopCondition().SetType(cwaiContinuous);
checker(pDlg->getCWAI()->Configure(),1); //problem!!!
checker(pDlg->getCWAI()->Start(),2);
return 0;
}
}
this is the function run in a worker thread, but I get run time errpr with that, the problem is with the configure() and start(). Can somebody tell me why? Thanks. By the way, I also wondering how to put the "return 0;" things, cos it can't run the start(), then end thread itself..