IDispatchEx functionality for COM interoperable .NET objects
- From: "Matt" <Matt@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 7 Jul 2005 14:28:02 -0700
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
>
>
>
.
- Prev by Date: Re: Getting CLSID and possibly MemberInfo from __ComObject...
- Next by Date: issue with writing tables into word document
- Previous by thread: Catching C# generated events with an ATL COM Sink
- Next by thread: issue with writing tables into word document
- Index(es):
Relevant Pages
|