BSTR not returned properly in vbscript 
Author Message
 BSTR not returned properly in vbscript

From VBScript, I'm calling a method that is returning a
BSTR.
STDMETHODIMP CTest::DoThis(BSTR *strVal)
{
...

Quote:
}

If I trace the string prior to exiting the method, the
value is correct, but if I display the string after
calling the method from vbscipt it is incorrect.  What are
the possible causes?

Thanks in advance for any replies.



Sat, 21 Feb 2004 11:54:19 GMT  
 BSTR not returned properly in vbscript
Hi,

Based on your post, the strVal should be an [out] parameter. Please use the
below method to assign value to it:

CComBSTR m_bstrString;  

STDMETHODIMP CTest::DoThis(BSTR *strVal)
{
           m_bstrString.CopyTo(pVal);  
        return S_OK;

Quote:
}

Thanks,
Freist


Sat, 21 Feb 2004 14:13:22 GMT  
 BSTR not returned properly in vbscript
VBScript (and JScript I think) can only handle VARIANTs as out parameters.
BSTRs and other data types can only be returned through [out, retval]
parameters.


Quote:
> From vbscript, I'm calling a method that is returning a
> BSTR.
> STDMETHODIMP CTest::DoThis(BSTR *strVal)
> {
> ...
> }

> If I trace the string prior to exiting the method, the
> value is correct, but if I display the string after
> calling the method from vbscipt it is incorrect.  What are
> the possible causes?

> Thanks in advance for any replies.



Sat, 21 Feb 2004 19:54:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CFile not working properly, can't figure out why (last message not sent properly)

2. BSTR to JScript or VBScript

3. Return Object to ASP/VBscript

4. Returning VB Boolean types for use in VBScript

5. Returning arrays of VARIANTs to VBScript

6. How to return an Array to VBScript

7. BSTR BSTR and BSTR

8. Why doesn't Pointer Return work properly?

9. My functions isn't returning a pointer properly

10. atl object with variant array [out] parameter do not work for vbscript

11. Aggregated methods not available in VBSCRIPT

12. Why VT_ARRAY|VT_VARIANT not supported in VB and VBScript

 

 
Powered by phpBB® Forum Software