Hi all,
I'm making a COM object in VC++, but I have a problem with a method returning a string.
the code in the COM class is goes like this:
when i call the method in VB:
I only get the first character of the string.
and if i replace
with
it returns an empty string.
Can anyone tell me how to resolve this?
Do i have to send an existing fixed length string? If so; how do i modify the strings contents?
thanks,
Johpje
I'm making a COM object in VC++, but I have a problem with a method returning a string.
the code in the COM class is goes like this:
Code:
STDMETHODIMP CCOMCLASS::get_String(/* [out/retval] */BSTR *pVal){
_bstr_t tmp;
tmp = _bstr_t(XXX);
*pVal = tmp;
return S_OK;
}
when i call the method in VB:
Code:
op$ = myComClass.String()
I only get the first character of the string.
and if i replace
Code:
*pVal = tmp;
Code:
pVal = new BSTR(tmp);
it returns an empty string.
Can anyone tell me how to resolve this?
Do i have to send an existing fixed length string? If so; how do i modify the strings contents?
thanks,
Johpje