Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving an imaq image to disk using CWIMAQVision

I'm not sure exactly why your code is not working. What I have been doing is going through the help documents trying to find calls that you can do without VDM. I came up with this method to save the image, but if that is not working, I might suggest going through the documentation to find other calls that can do the same thing.
Chris Van Horn
Applications Engineer
0 Kudos
Message 21 of 56
(5,863 Views)
Does the CWIMAQ.interface have to be set to anything?  It's value is currently blank.
0 Kudos
Message 22 of 56
(5,860 Views)

http://forums.ni.com/ni/board/message?board.id=200&message.id=11721&requireLogin=False

Take a look at this thread, on the second page one of your techs says

 

 

Hi -

Even if you don't have a license for Vision you can still use some methods on the CWIMAQVision control, including the File I/O methods such as WriteBMPFile.

Greg Stoll
Vision R&D
National Instruments

0 Kudos
Message 23 of 56
(5,854 Views)

Hey,

 

If another engineer says that it can be done, its possible that it can be. However, in the documentation I looked in, it said that function (at least write PNG) fell under VDM, meaning you would need an active copy. I would try the BMP to see if that works for you.

 

As far as entering values, I did not need to enter any when I created that code, I just used the code I gave you. (This is for the original writePNG code) after creating a CWIMAQVision object on the fp.

 

 

Chris Van Horn
Applications Engineer
0 Kudos
Message 24 of 56
(5,845 Views)

From your code:

 

CWIMAQ1.Interface = Text1.Text

 

 

What have you defined Text1 to be?

Message Edited by timmkish on 11-19-2008 01:02 PM
0 Kudos
Message 25 of 56
(5,841 Views)

That was part of the example, and was left as default.

 

The only thing I added at all was the vision object and the one line of code. 

Chris Van Horn
Applications Engineer
0 Kudos
Message 26 of 56
(5,836 Views)
Here's what the error looks like
0 Kudos
Message 27 of 56
(5,829 Views)

Hey timmkish,

 

I'll look into it some more, but I don't believe that you need the () where you are getting your error, I did not have that and my code worked. 

 

Since we are having so much trouble with this, I might reccomend opening an example, running a simple snap with no save, making sure it works. Then adding only the save line of code. Nothing else extra, just to make sure that you can do this before implementing the wait.

Chris Van Horn
Applications Engineer
0 Kudos
Message 28 of 56
(5,814 Views)

Chris,

That's what I'm trying to do. 

 

Except all of the Snap examples I've opened thusfar, do not have an CWIMAQ object on the form.  So I have to do two steps, add the CWIMAQ object in the designer window, then add the single line of code.  I've tried doing that and I'm getting that same error.

0 Kudos
Message 29 of 56
(5,810 Views)

Actually, I just found an example code in

F:\Documents and Settings\All Users\Documents\National Instruments\NI-IMAQ\Examples\MSVB.NET\Triggered Sequence\Triggered Sequence.vbp

 

that has the CWIMAQ object already part of the code.  Without modifying any part of the example code, running the program generates the exact same interface error on this line 

CWIMAQ1.LoadInterfaceDefaults()

 

What is interesting is the previous three lines of code:

CWIMAQ1.Images.RemoveAll()
CWIMAQ1.Images.Add(NumBuffers)
CWIMAQ1.Signals.Item("TriggerLine1").Initialize(LineType.SelectedIndex, NationalInstruments.CWIMAQControls.CWIMAQSignalActions.cwimaqCaptureStart,              

                               NationalInstruments.CWIMAQControls.CWIMAQSignalPolarities.cwimaqActiveHigh, LineNumber.SelectedIndex)


execute fine!  So the CWIMAQ object is at least partially behaving.  It's something to do with the CWIMAQ interface that keeps causing the error            

0 Kudos
Message 30 of 56
(5,809 Views)