reader->SynchronizingObject = this;
// error C2664: 'NationalInstruments::DAQmx::DigitalSingleChannelReader::set_SynchronizingObject' : cannot convert parameter 1 from 'CDiomxHandler *const ' to 'System::ComponentModel::ISynchronizeInvoke __gc *'
The synchronizing object must be an object that implements the ISynchronizeInvoke interface. When the synchronizing object is set, that object serializes (or otherwise synchronizes) methods, events, and callbacks that use the synchronizing object, for instance if you set the synchronizing object to a Windows Form object, all calls occur in the UI thread of that Form. Things that implement ISynchronizeInvoke include Windows Forms forms and controls.
If you are not
using Windows Forms for your UI, just leave this unset. The callbacks will then occur in a separate thread and, in your callback, you must do any synchronization that is necessary.
reader->BeginReadSingleSampleMultiLine (System::AsyncCallback (OnDataReady), NULL);
// error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'System::AsyncCallback' The syntax for creating an instance of a delegate is a little different in C++. Assuming that OnDataReady is a method of the CDiomxHandler class and that "this" is a pointer to a CDiomxHandler instance (i.e. you are making the call from within a member function), you would use
new System::AsyncCallback(this,&CDiomxHandler::OnDataReady) to get a pointer to a delegate.
You can find more information about the syntax for the Managed Extensions to C++
in the Visual Studio online help (or
on Microsoft's MSDN website).
Tony H.