LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing strings from ActiveX method to LabVIEW

Hello,

I'm trying to build a LabVIEW user interface for an ActiveX we have already build for Visual Basic. One of the methods takes pointers to strings as arguments to the method (passed as BSTR*). The method then fills information into the strings using the pointers. I have wired string controls to the input connectors for this method and wired the corresponding outputs of the method to local write variables of the string controls but I don't get the strings from the ActiveX. If I fill in a default string to one of the string controls, the string is just passed through the ActiveX method, but remains unchanged. Has anybody an idea what I'm making wrong?

Thanks, Sven.
0 Kudos
Message 1 of 6
(3,143 Views)
Are you using the "Variant to Data" function to convert the Variant to a string, or are you flattening it to a string? ActiveX Variants are a little different than regular LabVIEW variants, and you may need to use the "Variant to Data" function instead of flattening the Variant to a string.

-Jim
0 Kudos
Message 2 of 6
(3,143 Views)
Hi Jim,

thanks for your answer, but I'm not using the Variant data type to exchange the strings with the called method. Instead I'm using the BSTR* automation data type. With Visual Basic this works fine but obviously not with LabVIEW. The idea is to pass the address of the string to the ActiveX, manipulate it inside the method and return the output to the LabVIEW control which holds the string. It somewhat like a call-by-reference under C/C++.
0 Kudos
Message 3 of 6
(3,143 Views)
Try to use llb that founds here:

http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/c94071199e8f18ad86256b6400829e4e?OpenDocument
0 Kudos
Message 4 of 6
(3,143 Views)
Thanks for your hint. I already saw this library before, but it is not clear to me how I can get a pointer to a string which is located in a string control. Is this possible? I dont't want to allocate the memory for the strings dynamically using the AllocateMemory.vi.
0 Kudos
Message 5 of 6
(3,143 Views)
Hi SvenJung,

try to do this:

1) Allocate Memory ( with String Type),
2) SetCStr_by_Pointer (Connect your string to String input)
3) Use Duplicate Pointer as input to your ActiveX
4) Free Memory when you don't need more this pointer.
0 Kudos
Message 6 of 6
(3,143 Views)