LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Olympus Camera SDK: ActiveX variant pointer

Hi, I found one reference to this problem at
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RNAME=ViewQuestion
&HOID=5065000000080000000B410000&ECategory=LabVIEW.LabVIEW+General but the
guy's email wasn't in the posting so I can't contact him.

I'm trying to use the Olympus digital camera SDK with Labview. I can connect
to the camera, read and write most of the simple properties (number of
pictures, camera name, etc). However in the ActiveX control, the
GetPicture() method wants a pointer to a variant type array.

So thinking I understood the problem, I read propPicSize() to find the size
of the current picture. I initialized an array of U32, used a "to variant",
and wire that variant to the function. The function gi
ves no error (it used
to when I didn't pass in an intialized array) but I just get back the same
uninitialized array which I passed in.

I'm kind of confused for where to go from here, especially because I'm not
sure why I get no error but the same uninitialized array back.

-joey
0 Kudos
Message 1 of 5
(3,400 Views)
Joey
The hyperlink you posted to the similar problem didn't work for me. Maybe you could give the title. We've had challenges passing arrays in LabVIEW to ActiveX components. It's important to note that ActiveX (COM) uses the SAFEARRAY structure to pass arrays as parameters. The SAFEARRAY uses a locking mechanism which we needed to understand to solve our problem. SAFEARRAYS are the normal way Visual Basic arrays are stored. It's probably worth checking if you can do what you want with VB. Could give a clue if there's a problem with the control itself. Search on SAFEARRAY on the NI site there's a few useful articles.
regards Andrew.
Message 2 of 5
(3,400 Views)
Is it expecting an array of variants or a variant that is actually an array of U32s? I don't have this ActiveX control, but I have run into trouble with something like this before. I was sending an array of variants to an ActiveX server and nothing was happening. Instead, I sent a single variant that would be interpreted as an array of numerics and this fixed the problem.
J.R. Allen
0 Kudos
Message 3 of 5
(3,400 Views)
I was hoping I wasn't the only one alone in this problem!

With further investigation I think the problem is definately in passing the
array. The function expects a pointer to an allocated array. I attached my
snippet of my testing program which (should) make the situation pretty
obvious.

I initialized an 1-D array of the appropriate length (the size of the
picture), wired that to the input varBuffer on the control, and created a
variant indicator to show the result. I expected labview to coerce the 1-D
array to variant. I also tried the "to variant" just in case coercion was my
problem, but it behaved the same way. I expected the coercion takes care of
the safearray/variant issues.

Basically I get the same array (full of the number used to initi
alize) as I
had input. I'm suspecting that maybe there was an array copy or some other
pointer mischief? I'm kind of at a loss since Labview has pulled us so far
away from pointers!

-joey

"Andrew Madry" wrote in message
news:50650000000500000057C40000-1042324653000@exchange.ni.com...
> Joey
> The hyperlink you posted to the similar problem didn't work for me.
> Maybe you could give the title. We've had challenges passing arrays
> in LabVIEW to ActiveX components. It's important to note that ActiveX
> (COM) uses the SAFEARRAY structure to pass arrays as parameters. The
> SAFEARRAY uses a locking mechanism which we needed to understand to
> solve our problem. SAFEARRAYS are the normal way Visual Basic arrays
> are stored. It's probably worth checking if you can do what you want
> with VB. Could give a clue if there's a problem with the control
> itself. Search on SAFEARRAY on the NI site there's a few useful
> articles.
> regards Andrew.



[Attachment olympus.jpg, s
ee below]
0 Kudos
Message 4 of 5
(3,400 Views)
What happens if you make two separate calls to the GetPicture Method ie one to initialise it and one to extract the buffer? Do you get the error on the second call to extract the buffer with no input? Maybe one would expect to get the same result when you pass data in and out on the same call to the method.
0 Kudos
Message 5 of 5
(3,400 Views)