11-10-2008 04:34 PM
OK, I've given up on trying to get my code to work, so I'm going to try and adapt the 'Low-Level Grab' VB example to my uses.
I want to acquire an save an image every 10 min or so. I know how to config the timer for this, but when it comes to saving the image...
When I use the line of code
errorCode = CWIMAQVision1.WritePNGFile(myImage, "C:\image.png")
I get:
'Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown.'
Where and how do I need to define and configure the CWIMAQVision Object to correctly save an image and eliminate this error?
11-11-2008 12:02 PM
timmkish,
How many images are you trying to grab every 10 minutes? Or are you just wanting to SNAP one image every 10 minutes? I might try using the snap if you are only using one image, and then see if your save will work with that.
11-11-2008 03:06 PM
Just one image every 10 min. Regardless if I use the snap or grab function, when I write the following line of code:
errorCode = CWIMAQVision1.WriteImage(myImage, "C:\1394Image.img")
I declare the CWIMAQVision1 object in the "Friend Class MainForm" using the following statement:
Public CWIMAQVision1 As AxCWIMAQVision
I get the error: Object reference not set to an instance of an object. When the code tries to execute the writeJPEG function.
This is using the NI 'Snap1394' VB code. The code works just fine to snap an image and display it, now I just want to add the save feature. The 'writeimg' will output a the raw image file correct? My camera supports 12-bit, so I need to output a 16-bit image and not an 8-bit.
11-11-2008 04:46 PM - edited 11-11-2008 04:46 PM
Hey timmkish,
it took me some time to get this coded properly, but I eventually got it to work with a PNG and clicking the snap button. So, it does not have the timing in it, but it does work. I had to add a CWIMAQVision1 object to the front panel.
11-11-2008 05:21 PM
What is the code to correctly add a 'CWIMAQVision1 object to the front panel'?
I think this is where I'm getting screwed up. I'm a VBA newbie, so I'm probably making a simple (i.e. dumb) mistake
11-12-2008 08:10 AM - edited 11-12-2008 08:10 AM
timmkish,
Its not code to add the CWIMAQVision1 object, but you physically want to drag and drop it from your toolbox of controls. It should be listed in the toolbox along with other IMAQ controls, and once you run the code, it is hidden. You just want to add it so that you can reference it. It acts the same way as the CWIMAQ control that you see on your front panel form.
I hope this helps.
11-12-2008 05:02 PM
Warning 1 The referenced component 'niimaq1394' could not be found.
Error
2 'AxCWIMAQViewer' is ambiguous in the namespace
'NationalInstruments.CWIMAQControls'. F:\Documents and Settings\All
Users\Documents\National Instruments\NI-IMAQ for
IEEE-1394\Examples\MSVB.NET\Low Level Grab1394.NET\Low Level
Grab1394.vb 46 40 Low Level Grab1394
Error 3
'AxCWIMAQViewer' is ambiguous in the namespace
'NationalInstruments.CWIMAQControls'. F:\Documents and Settings\All
Users\Documents\National Instruments\NI-IMAQ for
IEEE-1394\Examples\MSVB.NET\Low Level Grab1394.NET\Low Level
Grab1394.vb 63 32 Low Level Grab1394
Error 4
'CWIMAQImage' is ambiguous in the namespace
'NationalInstruments.CWIMAQControls'. F:\Documents and Settings\All
Users\Documents\National Instruments\NI-IMAQ for
IEEE-1394\Examples\MSVB.NET\Low Level Grab1394.NET\Low Level
Grab1394.vb 236 24 Low Level Grab1394
Error 5
'AxCWIMAQVision' is ambiguous in the namespace
'NationalInstruments.CWIMAQControls'. F:\Documents and Settings\All
Users\Documents\National Instruments\NI-IMAQ for
IEEE-1394\Examples\MSVB.NET\Low Level Grab1394.NET\Low Level
Grab1394.vb 240 34 Low Level Grab1394
If I 'Add Reference', browse to my WINDOWS/System32 folder, I don't see the niimaq1394.dll file. I DO see: niimaqci.dll, niimaqdx.dll, and niimaqmem.dll
Should I add any of those? I was previously running an earlier version of theNI-IMAQ software and this is when I was successfully able to add the niimaq1394 as a reference.
11-12-2008 05:15 PM
Hmm,
I do know that the IEEE for 1394 drivers are the legacy versions which have been replaced by the IMAQdx. I would try adding the dx dll to see if that works. When I made this, I just used the snap example, added the one object to my front panel, and added the one line of code.
11-17-2008 01:01 PM
Now I get 'Unlicensed copy of NI Vision' error! Who do I talk to to get this cleared up? Everything should be licensed,
Just so we're on the same page, I'm using the.NET CWIMAQ, CWIMAQVision, etc controls (they look like gears in the toolbox), not the COM controls
11-17-2008 01:57 PM