LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ask Experts: Pass string to BSTR in COM

Hi,

I wrote a ATL COM executable in VC++ 6.0. The COM server includes a
method to read a data point from a file: (The advantage of COM is
obvious).

STDMETHODIMP ReadOnePoint(BSTR bstrFileName, double data_point)
{
CString cstrFileName = bstrFileName; //Convert to CString
.....
};

It's working well to call the method by an exmample client in VB6. But
when I tried to call the method in a VI (labVIEW 6.1) with ActiveX
automation (simply pass string to bstrFileName), VC++ can't open the
file even although the cstrFileName looks same as the one called by
VB6 in the Watch/Debug Windows of VC++. Seems that something is
hiddenly messed up when I passed string in VI to the COM server. Any
expert knows what is hiding in this?

TIA,

GC
0 Kudos
Message 1 of 3
(3,520 Views)
I got it. Thanks anyway. BSTR is a good way to pass string from
Labview to COM object. -GC

huer@yahoo.com (gxchem) wrote in message news:...
> Hi,
>
> I wrote a ATL COM executable in VC++ 6.0. The COM server includes a
> method to read a data point from a file: (The advantage of COM is
> obvious).
>
> STDMETHODIMP ReadOnePoint(BSTR bstrFileName, double data_point)
> {
> CString cstrFileName = bstrFileName; //Convert to CString
> ....
> };
>
> It's working well to call the method by an exmample client in VB6. But
> when I tried to call the method in a VI (labVIEW 6.1) with ActiveX
> automation (simply pass string to bstrFileName), VC++ can't open the
> file even although the cstrFileName looks same as the one called
by
> VB6 in the Watch/Debug Windows of VC++. Seems that something is
> hiddenly messed up when I passed string in VI to the COM server. Any
> expert knows what is hiding in this?
>
> TIA,
>
> GC
0 Kudos
Message 2 of 3
(3,520 Views)

I have similar case, My Com Dll is returning BSTR string, so how to convert that string to Labview indicator. I am getting a compiler error when I use Variant to Data structure and have a string const as a type.

 

Thanks in Advance

0 Kudos
Message 3 of 3
(3,246 Views)