Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxErrChk Error

Hello?
 
I'm testing this code whether DAQmx finds my legacy PCI-6025E device.
 
DAQmxErrChk code doesn't work for me.
 
My code is
 
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else

int CTestDialogClass::FindMyDAQLegacyDevice_With_DAQmx()
{
 
 int32  error=0;
 char  errBuff[2048]={'\0'};
 char  devNames[256]={'\0'};
 char  testDevName[256]={'\0'};

 /*********************************************/
 // DAQmx Configure Code
 /*********************************************/
 
 /* It seems that DAQmxGetDevProductType and
  * DAQmxGetSysDevNames function works w/o
  * creating a task.
  */
 
/* DAQmxErrChk  (DAQmxCreateTask("",&taskHandle));
 DAQmxErrChk  (DAQmxStartTask(taskHandle));
*/
 DAQmxErrChk (DAQmxGetDevProductType("Dev1", testDevName, 256));
 DAQmxErrChk (DAQmxGetSysDevNames(devNames,256));
// DAQmxGetDevProductType("Dev1", testDevName, 256);
// DAQmxGetSysDevNames(devNames,256);
 
 /*********************************************/
 // DAQmx Start Code
 /*********************************************/
 
 m_cstringProductName = testDevName;
 m_cstringDeviceName = devNames;
 
 Error:
  if( DAQmxFailed(error) )
   DAQmxGetExtendedErrorInfo(errBuff,2048);
   AfxMessageBox("DAQmx Error, DAQmx can't find the device", MB_OK,0);
/*  if( taskHandle!= 0 ) {        
      DAQmx Stop Code
      DAQmxStopTask(taskHandle);
      DAQmxClearTask(taskHandle);
   } */

 
  return 0;
}
 
As you see, I commented out some code to find which line makes an error. Even if I don't use DAQmxErrChk function and DAQmxCreateTask, the GetDevProductType and the DAQmxGetSysDevNames functions STILL works.
 
I wonder why the GetDevProductType and the DAQmxGetSysDevNames functions are working WITHOUT
I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 1 of 3
(6,515 Views)
Sorry for double posting. This is automatically done by my IE7. Could you delete this? Thanks.
I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 2 of 3
(6,509 Views)

This post has been answered here.

Ana P
National Instruments
Applications Engineer
0 Kudos
Message 3 of 3
(6,481 Views)