I didn't have too much trouble getting the ANSI C callback example going. That is, after wasting a lot of time trying to get it working on a simulated card, Googling for a clue as to why it didn't work, and then finding out from this forum that the much vaunted impementation of simulated devices doesn't actually support callbacks/events, making it pretty much useless for my purposes. Oh well.
But then I wanted to use the callbacks in my VB6 projects. There don't appear to be any examples provided of doing this with NIDAQmx, I wonder why? It may be possible, but they are certainly making it hard to find out how. I've tried converting from the C examples, I think I have a callback working, but the thing takes an exception and "I'm sorry, your application failed, would you like to tell Microsoft all about it?". Ok, I figure that I must need the callback to be synchronous for VB6, that the NIDAQmx async thread may be accessing my VB data out of context. But the type library doesn't contain the Option value for DAQmx_Val_SynchronousEventCallbacks, so I have to get it from the C header, NIDAQmx.h, where it is 1. I try that, but get an error message that "Requested value is not a supported value for this property". Ok, where do I go from here? Has anyone got a working example of a VB6 application using NIDAQmx and callbacks?
I know I shouldn't have naively believed all the promo guff about NIDAQmx being so much better and easier to use that "Traditional NIDAQ". And then figured that I should be able to upgrade several years worth of traditional code, written in VC and VB and including several OCX projects, to the new system in a week. I should have realized that the new stuff is still quite immature and will take time for people to become familiar with it and build up a code base, and that NI really doesn't have an interest in supporting legacy software, or they would have just updated the DAQ ActiveX controls.
Which brings up another question. One of the main ideas behind using ActiveX controls is that they can insulate large and complex applications from changes in underlying hardware. I make extensive use of this. Once an interface is defined, the ActiveX can be changed independently, the user application doesn't even have to be recompiled, so if NI had added the ability to talk to the NIDAQmx drivers to CWAI.ocx and family I would just have to register the new OCX and nothing else would need to be changed. I do this with OCX code I write all the time, adding in new functionality and never having to bother the guys who write the user apps. Why doesn't NI do this? If NIDAQmx is as good as the hype says, surely it should be a trivial matter to upgrade the ActiveX controls to support it?
Thanks for any helpful suggestions or examples,
David