p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: [out] and [in,out] called from VBS


Message #1 by "Phill Graham" <feelipg@y...> on Fri, 9 Mar 2001 10:31:33
Hello



I have a (VC++ ATL )component with a method:



HRESULT IsUserLoggedIn([in] VARIANT_BOOL is_live, [in,out]BSTR* 

current_usr, [out,retval] BSTR* profileName);



As you can see I want a string returned and a string passed in updated.

Now, whenever I call this from an ASP script I get a type mismatch.  This 

seems to be something to do with have an [out,retval] and an [in,out] in 

the same method - ie I don't get this error with the following:



HRESULT test([in,out]BSTR* inout);



However - the inout string above isn't updated after the call to test!!

test just does a SysReAllocString on inout - ie.



SysReAllocString(inout,L"This isn't working");



So I suppose my questions are:



1) Why can't I have [in,out] and [out,retval] in the same method??



2) Why doesn't test( ) update my string?



3) Am I correct is thinking VBS (and VB?) don't support [out] parameters 

at all?



Thanks for any help - I've been looking/reading a lot about this but can't 

find anything that helps.



Phill
Message #2 by Norberto Goussies <norberto.goussies@c...> on Fri, 9 Mar 2001 13:55:39 -0300
Phill,

You are defining current_usr as BSTR but because you are in ASP it's a

VARIANT.

Hope this help.



-----Mensaje original-----

De: Phill Graham [mailto:feelipg@y...]

Enviado el: viernes 9 de marzo de 2001 7:32

Para: ASP components

Asunto: [asp_components] [out] and [in,out] called from VBS





Hello



I have a (VC++ ATL )component with a method:



HRESULT IsUserLoggedIn([in] VARIANT_BOOL is_live, [in,out]BSTR* 

current_usr, [out,retval] BSTR* profileName);



As you can see I want a string returned and a string passed in updated.

Now, whenever I call this from an ASP script I get a type mismatch.  This 

seems to be something to do with have an [out,retval] and an [in,out] in 

the same method - ie I don't get this error with the following:



HRESULT test([in,out]BSTR* inout);



However - the inout string above isn't updated after the call to test!!

test just does a SysReAllocString on inout - ie.



SysReAllocString(inout,L"This isn't working");



So I suppose my questions are:



1) Why can't I have [in,out] and [out,retval] in the same method??



2) Why doesn't test( ) update my string?



3) Am I correct is thinking VBS (and VB?) don't support [out] parameters 

at all?



Thanks for any help - I've been looking/reading a lot about this but can't 

find anything that helps.



Phill

  Return to Index