Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't Create a Task Handle correctly?

Hello,
Why this simple code doesn't create a task handle for me?
 
It fails at the last line giving me error code of -200604 and saying that a null parameter was passed. When I ran the debugger, line # 3 seemed to be returning  a value and an address from the DLL.
 

typedef

int32 (WINAPI *DAQmxCreateTask_Ptr)(const char taskName[], TaskHandle taskHandle);

1- m_NILibrary=AfxLoadLibrary(

"nicaiu.dll");

2- DAQmxCreateTask_Ptr pDAQmxCreateTask =NULL;

3- pDAQmxCreateTask=(DAQmxCreateTask_Ptr)GetProcAddress(theApp.m_NILibrary,

"DAQmxCreateTask");

4- if

(pDAQmxCreateTask == NULL )

5-     return FALSE;

6- Status = pDAQmxCreateTask(

"Time Counter", m_taskHandle);  // Fails here

0 Kudos
Message 1 of 2
(6,160 Views)

Never Mind, I copied the wrong prototype of my function header from nidaqmx.h file.

Should have been:

1- typedef int32 (WINAPI *DAQmxCreateTask_Ptr)(const char taskName[], TaskHandle *taskHandle);

6- Status = pDAQmxCreateTask("Time Counter", &m_taskHandle); 

0 Kudos
Message 2 of 2
(6,155 Views)