IDispatch Invoke - propertyget or method. Whats the difference ?

Giganews Newsgroups
Subject: IDispatch Invoke - propertyget or method. Whats the difference ?
Posted by:  R.Wieser (addre…@not.available)
Date: Thu, 30 Apr 2020

Hello all,

I'm currently looking at the Invoke method from IDispatch, and specificaly
its flags.  I ran a testscript like this:
- - - - - - - - - - - - - - -
MsgBox MyObject.MyData("foo",42)
h = MyObject.MyData("foo",42)
- - - - - - - - - - - - - - -
For the first I got just the DISPATCH_METHOD flag, but for the second I got
both the DISPATCH_METHOD and DISPATCH_PROPERTYGET flags, and I have no idea
why.    Does anyone have an idea ?

Also, I have a bit of a problem interpreting the MSDN page regarding to the
wFlags member:
- - - - - - - - - - - - - - -
DISPATCH_METHOD - The member is invoked as a method. If a property has the
same name, both this and the DISPATCH_PROPERTYGET flag can be set.
- - - - - - - - - - - - - - -
First: "invoked as a method" ?  How is that relevant ?  But in that case,
whats the difference between the two lines of my example code ?
Second: "has the same name" ?  The same as which other name where ?

- - - - - - - - - - - - - - -
DISPATCH_PROPERTYGET - The member is retrieved as a property or data member.
- - - - - - - - - - - - - - -
What is (if at all) the difference between a "property" and a "data member"
(preferrably explained codewise) ?

- - - - - - - - - - - - - - -
DISPATCH_PROPERTYPUTREF -  The member is changed by a reference assignment,
rather than a value assignment. This flag is valid only when the property
accepts a reference to an object.
- - - - - - - - - - - - - - -
"This flag is valid only when" ?    I don't get that distinction.  To me it
looks like it indicates that the provided argument is a(n object only ?)
reference, leaving it up to the code handling the assignment to do something
with it or not.  Not doing something with that flag certainly doesn't
magically invalidate the flag itself.  So, what than are they trying to tell
me/us there ?

Reference:
The above object was added to a scriptengine using
IActiveScript::AddNamedItem.  It also doesn't have a typelib (no peeking
into the ammount and types of arguments that a method accepts).

Regards,
Rudy Wieser

Replies