Re: VBS gets empty string
From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 07/28/04
- Next message: Willa: "sproxy.exe error SDL1005 unrecognized tag"
- Previous message: Alexander Nickolov: "Re: How to return string through output VARIANT from C++ COM object"
- In reply to: Eran: "VBS gets empty string"
- Next in thread: Eran: "Re: VBS gets empty string"
- Reply: Eran: "Re: VBS gets empty string"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Jul 2004 10:00:01 -0700
VBScript can only deal with VARIANTs. It cannot get your
BSTR back. Also, you cannot have [out] arguments in
Automation (and VBScript laughs at them all the same).
Change it to [in, out] VARIANT*. Even simpler, why don't
you use [out, retval]? Then you can stick with returning
a BSTR and your server code won't change, only your
script code. As for [in, out], there is a lengthy thread in
this group detailing just that topic, I suggest you give it a
look:
How to return string through output VARIANT from C++
COM object
-- ===================================== Alexander Nickolov Microsoft MVP [VC], MCSD email: agnickolov@mvps.org MVP VC FAQ: http://www.mvps.org/vcfaq ===================================== "Eran" <even_e@netvision.net.il> wrote in message news:e1Yh2QKdEHA.556@tk2msftngp13.phx.gbl... > Hi, > > I need help for the following issue. I have a COM server in C++ and client > in VBS. in some reason, the VBS gets empty string from COM. > > the implemintation is as follows: > > [COM] > [id(4), helpstring("method RetString")] HRESULT ReturnString([out] BSTR > *RetString); > > > STDMETHODIMP CETS_Interface::ReturnString(BSTR *RetString) > { > > char MyString[10] = "temp"; > *RetString = A2BSTR(MyString); > return (*RetString != NULL) ? S_OK : E_OUTOFMEMORY; > } > > > [VBS] > > ' ETS_Interface of "ETS.ETS_Interface.1" > ' ETS_Interface Class > Set objETS_Interface = CreateObject("ETS.ETS_Interface") > > Dim mystring > > objETS_Interface.RetString(mystring) > MsgBox(mystring) ' in some reason, I mystring is empty here. > >
- Next message: Willa: "sproxy.exe error SDL1005 unrecognized tag"
- Previous message: Alexander Nickolov: "Re: How to return string through output VARIANT from C++ COM object"
- In reply to: Eran: "VBS gets empty string"
- Next in thread: Eran: "Re: VBS gets empty string"
- Reply: Eran: "Re: VBS gets empty string"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|