LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a string from COM into Labview

My colleagues are modifying a traditional C++ library to a COM interface. My task is to write a labview application that uses the methods of the DLL.
One function returns a string.
The original DLL would allocate memory for a BSTR and return a pointer to that area.

geterror ([in] int nr, [out]BSTR * Errstring)

Labview recognizes that a string is returned for that method, but executing the VI creates a memory access error.

So how do I get a string text out of the DLL and into LV?

For a normal C-dll I used to write a wrapper that would interpret a LV Stringhandle entered as input parameter.
Unfortunatly the COM/ActiveX interface for LV is pretty poorly documented.
Has anyone encountered a similar p
roblem ?
TIA
7.1 -- 2013
CLA
0 Kudos
Message 1 of 2
(2,658 Views)
Hi Gabriela-

Good question. Luckily a colleague of mine made a great example that demonstrates how to access a Active X dll to and from LabView.
I just ran it and it works marvelously. Be sure to register the dll (made in Visual Basic, and hence, an Active X dll) with regsvr as explained in the readme. Also, the Active X reference on the VI front panel might point to the wrong Active X class and there might be broken arrows when you initially open the project. Just right-click on the reference and re-choose the correct class (i think in this instance it was named Project 1.0 Version 1.0 - very descriptive I know.)

You can download the example by:
1. going to www.ni.com/support
2. choose LabView from products
3. choose "Example Programs" from support resources
4.
enter the serach string -> ActiveX dll labview

The first 2 examples returned are both great, but the second handles strings like you requested.

good luck
ben schule
national instruments
0 Kudos
Message 2 of 2
(2,658 Views)