Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write a DAQmx MFC message handler?

Does anyone know how to write a DAQmx message handler?  I believe that this uses the technique of Message Maps.
 
I am using a PCI-6251 card.
 
Thanks,
 
Kevin
0 Kudos
Message 1 of 5
(4,134 Views)
Kevin,

The DAQmx C++ examples in the C:\Program Files\National Instruments\MeasurementStudioVS2003\VCNET\Examples\DAQmx\ directory should give you a good start. In particular, the ContAcqVoltageSamples_IntClk example in the C:\Program Files\National Instruments\MeasurementStudioVS2003\VCNET\Examples\DAQmx\Analog In\Measure Voltage\ directory demonstrates a DAQmx reader callback. Is this what you are looking for?

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 2 of 5
(4,119 Views)

Hi Ryan,

  Thank you for replying to my post.  "Reader callback" is not the approach that I would like to take.  I would like to write a Windows MFC program using C++.  This type of program would use a message queue, a message loop (provided by MFC), and a message handler.  Most of the NI C++ examples are the traditional sequential programs with a main() function for a console program.

  NI has an article "An Overview of DAQ Events and Occurences."  In this article in the "MFC Notes" section it uses the message WM_NIDAQ_MSG and the message handler OnDAQMessage.  I believe ON_MESSAGE is a macro with two parameters that is inserted into the Message Map.  My guess is that this macro associates the WM_NIDAQ_MSG message with the OnDAQMessage member function.  The last step is to call the function Config_DAQ_Event_Message.

  I have followed the article, and my program compiles fine with one exception.  When I add the line Config_DAQ_Event_Message(1,1,"AI0",5,4.9.4.8,0,0,0,0, WM_NIDAQ_MSG, 0) I get the the error LNK2019: unresolved external symbol _Config_DAQ_Event_Messag@ 48.

  I think that there are some setting I am missing in Visual Studio because I get the same LNK2019 error when I add any other comand such as Init_DA_Brds.

  Any observations on the approach?

  How can I get rid of the LNK2019 error?

Thanks,

Kevin

 

Message Edited by EW on 03-17-2006 09:52 AM

0 Kudos
Message 3 of 5
(4,111 Views)
Kevin,

The Config_DAQ_Event_Message and Init_DA_Brds functions are part of the API for our Traditional NI-DAQ (Legacy) driver. It is not possible to use these in conjunction with NI-DAQmx. Additionally, your 6251 does not support use of the Traditional driver. Is there a reason that a callback is not an option? Generally, this is more efficient as it allows you to easily perform data acquisition in one thread and GUI updating in another. I know of no such Windows message equivalent for DAQmx.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
Message 4 of 5
(4,095 Views)

Hi Ryan,

I will start to look into how to use the reader callback approach.

Thanks for your help.

Kevin

0 Kudos
Message 5 of 5
(4,069 Views)