Re: COM Collections/arrays accessed from JScript

Tech-Archive recommends: Fix windows errors by optimizing your registry



I dug up a similar solution that involves implementing IDispatchEx, which
also seems to work....

Now, a second part to the question involves implementing this functionality
across COM-interop for a .Net comvisible object.

Is that possible?

"Igor Tandetnik" wrote:

> "Matt" <Matt@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:E9404A0A-2D0B-463B-B04C-E1A4F3F181DD@xxxxxxxxxxxxx
> > What enables the following indexing (use of []) behavior from JScript
> > for the Microsoft MSXML DOM?
> >
> > var xmldom = new ActiveXObject("Microsoft.XMLDOM");
> > xmldom.loadXML("<hello><world/></hello>");
> >
> > var child = xmldom.childNodes[0];
> > var mystring = child.xml
>
> In JavaScript, the following two expressions are equivalent:
>
> obj.propertyName
> obj["propertyName"]
>
> except that, using a string rather than an identifier, the latter syntax
> can access properties with names that contain characters not allowed in
> identifiers. E.g. this is legal:
>
> var obj = new Object();
> obj["@#$%"] = "Hello";
> alert(obj["@#$%"]);
>
> There is no special case for numeric indexers - the number is converted
> to string under the usual rules, and the property with a name such as
> "0" is accessed normally.
>
> To support this feature in your objects, you need to implement
> GetIDsOfNames to recognize all-numeric property names. When you see one
> of these, give out a DISPID from some range you reserve. Further, you
> need to code Invoke to recognize these special DISPIDs and redirect to a
> method like item(index)
> --
> 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
>
>
>
.



Relevant Pages

  • IDispatchEx functionality for COM interoperable .NET objects
    ... >> var mystring = child.xml ... > except that, using a string rather than an identifier, the latter syntax ... > need to code Invoke to recognize these special DISPIDs and redirect to a ...
    (microsoft.public.dotnet.framework.interop)
  • Re: COM Collections/arrays accessed from JScript
    ... > var mystring = child.xml ... except that, using a string rather than an identifier, the latter syntax ... need to code Invoke to recognize these special DISPIDs and redirect to a ...
    (microsoft.public.win32.programmer.ole)
  • Double Linked List Help
    ... 256 characters long identified in the input file F. Each identifier ... identifier, length is an integer representing the length of the ... string is a string of characters representing the identifier itself. ...
    (comp.lang.c.moderated)
  • Re: kde4 and opengl
    ... server glx vendor string: NVIDIA Corporation ... Identifier "Simple Layout" ...
    (comp.windows.x.kde)
  • Re: Countif in VB Script
    ... identifies/keeps track of its patients. ... However, they use a wrist band identifier, which is usually not subject ... The collection keeps track what it has stored by using a unique string ... colvalues.add vbNullString, CStr.value) ...
    (microsoft.public.excel.programming)