Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can automation object modify parameter (string) ?

Status
Not open for further replies.

OldCoder

Programmer
Aug 21, 2001
1
US
I have an automation object that takes a BSTR and truncates the string to an arbitrary length. When I call it from C++ it cuts the string. When I call it from vbscript the object cuts the string that it is given but vbscript never sees the change. Is there a rule about this ?

Dim Str
Dim Cutter
Str = "To be or not to be vb"
set Cutter = CreateObject ("Cooler.Class")
if not IsObject(Cutter) then
WScript.Echo("No Cooler.Class Found")
WScript.Quit()
else
WScript.Echo("Cutter Okay")
end if

Cutter.MaxLength = 5
Cutter.Truncate2(Str)
-----------------------------------------------------
interface IClass : IDispatch
{
[id(1), helpstring("method Truncate")] HRESULT Truncate([in, out, ptr] BSTR * data);
[propget, id(2), helpstring("property MaxLength")] HRESULT MaxLength([out, retval] long *pVal);
[propput, id(2), helpstring("property MaxLength")] HRESULT MaxLength([in] long newVal);
[id(3), helpstring("method Truncate2")] HRESULT Truncate2([in, out, ptr] BSTR datum);
};

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top