Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

event callbacks in Visual Basic 6.0 (VB6) with NI-DAQmx C-API crashes VB environment when exiting example app

Hello,

 

 

I am not using Measurement Studio for this application.  I found quite a bit of non Measurement Studio  questions in this board so that is why I posted it here.

 

I have an application that crashes the VB environment when my application closes.  The application itself does everything I need it to do but it would be able to stay inside the environment.  The message is below.

 

'Visual Basic has encountered a problem and needs to close.  We are sorry for the inconvenience'.... There are buttons to 'Send Error Report' and 'Don't Send'

 

I downloaded the original NI example that I based my code on and the same thing happens which makes me feel better about my code 🙂

 

 

I found the code by doing a search for 'NI-DAQmx: Continuous Analog Acquisition with NI-DAQmx Events in Visual Basic 6.0'. There was a code sample in the NI Developer Zone.  The zip to download is 200036.zip and VB project name once you unzip it is Cont Acq-Int Clk-Every N Samples Event (VB6).vbp

 

It seems like when I do the following code this happens when I exit.  If I remark out these lines it does not crash.  I do not have to an acquisition to have happened for this app to crash.  As long as I configure my tasks without actually doing anything with them the environment will crash on exit of an application.

 

'Configure Event Callbacks
    DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(ContinuousTaskhandle, 1, intContinuousSamplesperChannel, 0, AddressOf ContinuousEveryNSamplesEventHandler, "")) ' Nothing))
  
    DAQmxErrChk (DAQmxRegisterDoneEvent(ContinuousTaskhandle, 0, AddressOf TaskDoneEventHandler, Nothing))
 

I am using this with an SCXI-1000DC package with a SCXI-1520.  I don't know if this problem is related to the hardware or would happen with other hardware as well.

 

I have searched to see if others have had this problem but I have not found any issue.

 

thanks, 

 

 

0 Kudos
Message 1 of 14
(11,955 Views)

Try running finite acqusition example and see if you still see the same behavior. If so then something worng with the version of VB and might switch to .NET instead.

 

lab

0 Kudos
Message 2 of 14
(11,926 Views)

Hi,

 

I'm working with vba and the C-API of the DAQmx and I have the same problem withe the Event. Everytime I stop or clear the task or close Excel without stopping or closing Excel crashes. Unfortunately, I can't switch to .NET

Is this a known problem and is there a solution?

 

with kind regards,

 

Alex 

0 Kudos
Message 3 of 14
(11,671 Views)

Alex,

 

I could not find anything on NI's website that addressed my problem and no one responded back to my message so it must not have been a problem for most people.

 

I am using NIDAQmx with a SCXI-1000DC system and thought maybe it was the interaction with that specific hardware but found that if I created a simulated device it also crashed my environment.  BTW, I was using NI-DAQmx drivers v9.0.

 

The way I resolved my problem was to go to a previous version of NIDAQmx drivers.  I was somewhat in a hurry to resolve this issue so I could not diagnose this issue as thoroughly as I would like.  Anyway, when I noticed that it was crashing on the production system but not my test PC (my notebook) that was running 8.7.1f3 I tried removing all drivers and installing the latest drivers (which was whatever was available approximately on March 12, 2010.  That did not work so I then installed 8.7.1f3 which is still available on the NI website although you need to make select (something like) 'more downloads'. 

 

Please let me know if this helps you out and if you have a different resolution.  I would appreciate any additional info that might help me.

 

Thanks, David 🙂

0 Kudos
Message 4 of 14
(11,652 Views)

Hello David,

 

thanks for the quick reply. I will follow your suggestion and try the DAQmx 8.7.1. Do you know if there are some differences in the C-API to the newer DAQmx? I will report my (un)success as soon as possible.

 

Alex

0 Kudos
Message 5 of 14
(11,649 Views)
In my code there was no difference.  I doubt that the NI-DAQmx C-API will change much.
0 Kudos
Message 6 of 14
(11,646 Views)

David,

 

I've followed your advice and installed the older DAQmx. At the moment I would say it works. So, thanks for the hint, this saved me a lot of research. Nevertheless this is strange to me.

 

with kind regards,

 

Alex 

0 Kudos
Message 7 of 14
(11,558 Views)

Alex,

 

 

Thanks for the feedback.  If you happen to resolve this issue please post something here.  I will do the same if I find anything out.  At some point I would like to resolve using the later version of DAQmx.  Last week we were using the equipment almost continuously  for 12 hours a day for about 5 days with no problems.

 

With this problem I did contact NI phone support but they could not help me either (although I did continue with them after a couple of days) so it does not seem to be a common problem.

 

BTW, what version of Windows are you using?  I am using XP.

 

David

Message Edited by Chapashop on 03-31-2010 07:49 AM
0 Kudos
Message 8 of 14
(11,553 Views)

I have the same problem here.

I'll try backing up a few NiDAQmx versions and see if that help.

 

John

 

0 Kudos
Message 9 of 14
(11,009 Views)
Let us know what happens please. 🙂
0 Kudos
Message 10 of 14
(11,002 Views)