LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX - Reg Event Callback: Array locked error 10

So a little background. I'm trying to write up some updated software to handle interacting with countless DVT vision cameras we have all over our manufacturing plants. DVT offers some rather old but still functional ActiveX controls to connect, manipulate and control the cameras. I've had a great deal of success writing Labview programs to accomplish this up until this snag. Right now I'm dealing with an ActiveX event that occurs when the camera captures an image, upon this event it returns a bunch of info regarding what took place during the inspection.

 

What happens is that the ActiveX Registered Event triggers once and the variant array gets returned without any problems. However, as soon as the event takes place a second time it locks up and returns the VB error 10: This array is fixed or temporarily locked. What's strange is I was able to get this to work last week and now I just can't seem to get over this error 10 hurdle. Any advice or suggestions would be most appreciated.

 

Main VI 

Event Caller Sub-VI

 

Info about the ActiveX event from the DVT help file:

"OnImageWithInfo Event

This event behaves exactly as the OnImage event but has an argument that provides additional information about the image.

Syntax

object_OnImagewithInfo(ImageInfo() as Variant)

 

object   An object expression that evaluates to a DVTSID object.

 

Arguments

The argument ImageInfo is a zero-based variant array to allow for different types of information and expansion in future releases of the control.  Below is a detailed description of the information that is presented in this parameter.

 

Element

Contents

ImageInfo(0)

ImageID as Double

ImageInfo(1)

Result as Integer

ImageInfo(2)

ColorMode as Integer

ImageInfo(3)

Resolution as Integer

ImageInfo(4)

ImageName as String

"

 

 

0 Kudos
Message 1 of 5
(3,684 Views)
No suggestions? Is this a poorly written DLL problem? Did I not provide enough info?
0 Kudos
Message 2 of 5
(3,649 Views)

Hi Nickless,

 

You indicated that the you were able to get this to work last week, and then hit the snag. Did you change anything with the system setup or code? Also, is it possible that your event is triggering to quickly before the array is fully processed? Lastly, can you tell us which block is giving you the error?

Joshua B.
National Instruments
0 Kudos
Message 3 of 5
(3,637 Views)

Probably not the answers you'd want to hear. When I first got it working I was messing around with a DVT camera emulator at my apartment. I got it working in a temporary VI and was pretty confident in myself so I deleted the project and went to integrate it in the main program I had been writing. I haven't been able to get this function to work ever since. The event itself only gets triggered about once a second at it's fastest because that's about the speed our lines run at here, so I don't think it's an issue of the event taking place too fast. I can't tell what block is giving the error because the strictly typed VI reference gets called in the background with the registered event. It should be noted even when I leave the reference VI completely empty it still returns this error so I'm pretty sure its a memory management issue.

 

What I believe it happening is that Labview calls on the VI, it opens and locks the memory location the DLL is writing to. Labview for this reason can get the first value without a problem but as soon as the event happens again the DLL can no longer write the new information and it errors out which in turn causes Labview to hang.

 

Is there anyway to setup the sub-VI to reference incoming data with pointers or some other means of read only control? Maybe instead close the VI after every iteration or release it's memory references?

 

edit: by the way Request Deallocation Function does not work

Message Edited by Nickless on 01-06-2009 10:04 AM
0 Kudos
Message 4 of 5
(3,628 Views)
A couple of items. Can you develop with the camera that you used in your apartment. I noticed that your event is set to time out in 500 ms after the first pass, what happens if you increase this value? To check if is a memory management issue, try closing and opening the VI after each pass to see what happens.
Joshua B.
National Instruments
0 Kudos
Message 5 of 5
(3,610 Views)