Re: Passing array of BSTR from JavaScript to VC++
<sanjay.kaleswaran@gmail.com> wrote in message
news:1146900424.653093.242720@y43g2000cwc.googlegroups.com
I have a array of string in JavaScript How do i send this array of
strings to a vc++ dll. I have successfully sent it as a single BSTR
to dll But when I send an array of BSTR JavaScript throws an error
saying "Variable uses an automation that is not supported in JScript"
Can any1 tell me how i can solve this.
If JavaScript is the only client you care about, or if you are willing
to write code specifically to work with JavaScript, this is what you can
do. A JavaScript array appears to COM as an automation object, that is,
an object implementing IDispatch. This object has a property named
"length" as well as properties named "0", "1" and so on (yes, property
names don't have to be valid identifiers). You can access these
properties with the usual GetIdsOfNames / Invoke dance. Or, since you
are using ATL, you might find CComDispatchDriver helpful:
http://groups.google.com/group/microsoft.public.vc.atl/browse_frm/thread/40bdbe51edaaec83/74e06e543c78e5a9
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925