Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The world is coming to an end--save your buffers!


devel / comp.os.ms-windows.programmer.win32 / IDL - how to define and call an objects default method ?

SubjectAuthor
* IDL - how to define and call an objects default method ?R.Wieser
`* Re: IDL - how to define and call an objects default method ?JJ
 `* Re: IDL - how to define and call an objects default method ?R.Wieser
  `* Re: IDL - how to define and call an objects default method ?JJ
   `* Re: IDL - how to define and call an objects default method ?R.Wieser
    `* Re: IDL - how to define and call an objects default method ?JJ
     `* Re: IDL - how to define and call an objects default method ?R.Wieser
      `- Re: IDL - how to define and call an objects default method ? Found it.R.Wieser

1
IDL - how to define and call an objects default method ?

<stlrao$18ah$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=374&group=comp.os.ms-windows.programmer.win32#374

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: IDL - how to define and call an objects default method ?
Date: Sat, 5 Feb 2022 13:41:42 +0100
Organization: Aioe.org NNTP Server
Lines: 24
Message-ID: <stlrao$18ah$1@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="41297"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-Notice: Filtered by postfilter v. 0.9.2
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MSMail-Priority: Normal
 by: R.Wieser - Sat, 5 Feb 2022 12:41 UTC

Hello all,

I've written a simple array-type object, and would like to be able to set a
default getter and setter for the object. IOW, instead of (in VBScript)
writing

MyArray.SetField(3,2) = "42"
wscript.echo MyArray.GetField(3,2)

I would be able to use (something like)

MyArray(3,2) = "42"
wscript.echo MyArray(3,2)

Although I've seen the "default action" possibility somewhere (Python IIRC),
I do not even know if its possible in Windows (win32).

Question: Is it possible to define (in the typelib?) a default action
(method, property) for an object ? And if so how ?

Regards,
Rudy Wieser

Re: IDL - how to define and call an objects default method ?

<11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=375&group=comp.os.ms-windows.programmer.win32#375

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!eGsadS2x+5dyoWiHthpKow.user.46.165.242.91.POSTED!not-for-mail
From: jj4public@gmail.com (JJ)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ?
Date: Sun, 6 Feb 2022 23:46:22 +0700
Organization: Aioe.org NNTP Server
Message-ID: <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net>
References: <stlrao$18ah$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="34788"; posting-host="eGsadS2x+5dyoWiHthpKow.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.84
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Notice: Filtered by postfilter v. 0.9.2
 by: JJ - Sun, 6 Feb 2022 16:46 UTC

On Sat, 5 Feb 2022 13:41:42 +0100, R.Wieser wrote:
> Hello all,
>
> I've written a simple array-type object, and would like to be able to set a
> default getter and setter for the object. IOW, instead of (in VBScript)
> writing
>
> MyArray.SetField(3,2) = "42"
> wscript.echo MyArray.GetField(3,2)
>
> I would be able to use (something like)
>
> MyArray(3,2) = "42"
> wscript.echo MyArray(3,2)
>
> Although I've seen the "default action" possibility somewhere (Python IIRC),
> I do not even know if its possible in Windows (win32).
>
> Question: Is it possible to define (in the typelib?) a default action
> (method, property) for an object ? And if so how ?
>
> Regards,
> Rudy Wieser

Property ID 0 will be the default value of an object.

Re: IDL - how to define and call an objects default method ?

<stqonn$vlf$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=376&group=comp.os.ms-windows.programmer.win32#376

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ?
Date: Mon, 7 Feb 2022 10:25:01 +0100
Organization: Aioe.org NNTP Server
Lines: 38
Message-ID: <stqonn$vlf$1@gioia.aioe.org>
References: <stlrao$18ah$1@gioia.aioe.org> <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net>
Injection-Info: gioia.aioe.org; logging-data="32431"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-RFC2646: Format=Flowed; Original
X-Priority: 3
X-Notice: Filtered by postfilter v. 0.9.2
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-MSMail-Priority: Normal
 by: R.Wieser - Mon, 7 Feb 2022 09:25 UTC

JJ,

> Property ID 0 will be the default value of an object.

Thanks. Initially I though you just ment the first-defined one there, and
it took me a while to realise you might have ment it literally. :-)

Though it seems that there are a few pitfalls when accessing that default :

The below won't quite do what I thought it would (only figured that out
after displaying the "typename" of 'MyArray' :-\ ) :

MyArray = 42

I have to use

MyArray() = 42

instead.

And while

wscript.echo MyArray

now (calls the defined PropertyGet) returns its value,

wscript.echo MyArray()

throws an error. Trying to change the IDLs PropertyGet into a method causes
a "duplicate definition" error. Not really funny, having to use two
different notations for the same thing ...

Any ideas ?

Regards,
Rudy Wieser

Re: IDL - how to define and call an objects default method ?

<6ztcgp3tbz71$.1pd80gla5yth$.dlg@40tude.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=377&group=comp.os.ms-windows.programmer.win32#377

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!eGsadS2x+5dyoWiHthpKow.user.46.165.242.91.POSTED!not-for-mail
From: jj4public@gmail.com (JJ)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ?
Date: Tue, 8 Feb 2022 16:09:21 +0700
Organization: Aioe.org NNTP Server
Message-ID: <6ztcgp3tbz71$.1pd80gla5yth$.dlg@40tude.net>
References: <stlrao$18ah$1@gioia.aioe.org> <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net> <stqonn$vlf$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="35311"; posting-host="eGsadS2x+5dyoWiHthpKow.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.84
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
X-Notice: Filtered by postfilter v. 0.9.2
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
 by: JJ - Tue, 8 Feb 2022 09:09 UTC

On Mon, 7 Feb 2022 10:25:01 +0100, R.Wieser wrote:
>
> Though it seems that there are a few pitfalls when accessing that default :
>
> The below won't quite do what I thought it would (only figured that out
> after displaying the "typename" of 'MyArray' :-\ ) :
>
> MyArray = 42
>
> I have to use
>
> MyArray() = 42
>
> instead.
>
> And while
>
> wscript.echo MyArray
>
> now (calls the defined PropertyGet) returns its value,
>
> wscript.echo MyArray()
>
> throws an error. Trying to change the IDLs PropertyGet into a method causes
> a "duplicate definition" error. Not really funny, having to use two
> different notations for the same thing ...
>
> Any ideas ?
>
> Regards,
> Rudy Wieser

Start by describing what you actually use for the default property.

Re: IDL - how to define and call an objects default method ?

<stts39$utq$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=378&group=comp.os.ms-windows.programmer.win32#378

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ?
Date: Tue, 8 Feb 2022 14:44:03 +0100
Organization: Aioe.org NNTP Server
Lines: 16
Message-ID: <stts39$utq$1@gioia.aioe.org>
References: <stlrao$18ah$1@gioia.aioe.org> <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net> <stqonn$vlf$1@gioia.aioe.org> <6ztcgp3tbz71$.1pd80gla5yth$.dlg@40tude.net>
Injection-Info: gioia.aioe.org; logging-data="31674"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Notice: Filtered by postfilter v. 0.9.2
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MSMail-Priority: Normal
 by: R.Wieser - Tue, 8 Feb 2022 13:44 UTC

JJ,

> Start by describing what you actually use for the default property.

Lol, the pot calling the kettle black (no offence ment).

Would you accept that I use the value 42 for it ? :-)

If not, what exactly are you asking for ? The IDL definition ? The code
I wrote ? The way I try to access it from within VBScript ? Something
else ?

Regards,
Rudy Wieser

Re: IDL - how to define and call an objects default method ?

<xw8d4vgh1hq1.t8tqughxioxy.dlg@40tude.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=379&group=comp.os.ms-windows.programmer.win32#379

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!eGsadS2x+5dyoWiHthpKow.user.46.165.242.91.POSTED!not-for-mail
From: jj4public@gmail.com (JJ)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ?
Date: Wed, 9 Feb 2022 00:11:06 +0700
Organization: Aioe.org NNTP Server
Message-ID: <xw8d4vgh1hq1.t8tqughxioxy.dlg@40tude.net>
References: <stlrao$18ah$1@gioia.aioe.org> <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net> <stqonn$vlf$1@gioia.aioe.org> <6ztcgp3tbz71$.1pd80gla5yth$.dlg@40tude.net> <stts39$utq$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="47573"; posting-host="eGsadS2x+5dyoWiHthpKow.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: 40tude_Dialog/2.0.15.84
X-Notice: Filtered by postfilter v. 0.9.2
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
 by: JJ - Tue, 8 Feb 2022 17:11 UTC

On Tue, 8 Feb 2022 14:44:03 +0100, R.Wieser wrote:
>
> Lol, the pot calling the kettle black (no offence ment).
>
> Would you accept that I use the value 42 for it ? :-)
>
> If not, what exactly are you asking for ? The IDL definition ? The code
> I wrote ? The way I try to access it from within VBScript ? Something
> else ?
>
> Regards,
> Rudy Wieser

There's simply not enough information to see what went wrong.

Re: IDL - how to define and call an objects default method ?

<stuhlv$6if$2@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=380&group=comp.os.ms-windows.programmer.win32#380

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ?
Date: Tue, 8 Feb 2022 20:51:48 +0100
Organization: Aioe.org NNTP Server
Lines: 41
Message-ID: <stuhlv$6if$2@gioia.aioe.org>
References: <stlrao$18ah$1@gioia.aioe.org> <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net> <stqonn$vlf$1@gioia.aioe.org> <6ztcgp3tbz71$.1pd80gla5yth$.dlg@40tude.net> <stts39$utq$1@gioia.aioe.org> <xw8d4vgh1hq1.t8tqughxioxy.dlg@40tude.net>
Injection-Info: gioia.aioe.org; logging-data="6735"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-Notice: Filtered by postfilter v. 0.9.2
 by: R.Wieser - Tue, 8 Feb 2022 19:51 UTC

JJ,

> There's simply not enough information to see what went wrong.

As far as I can tell nothing goes wrong. Its just a question of how to
handle what I'm getting presented.

Your suggestion to give a propertyget/propertyset combination an ID of Zero
did work. Its just that I've than tried to use the VBS commands as
described in my initial post, but not getting the expected results (I do not
see a propertyget / propertyset - and sometimes errors are thrown).

Though I found out that all objects are supposed to be able to be part of a
'collection', and that the first "( )" is supposed to indicate which element
of the collection the object is supposed to be.

IOW, I can now write

MyArray()(3,4) = 42

and

wscript.echo MyArray()(3,4)

and see my object be accessed - and than throwing an error because it wants
to access a method, not a property.

Personally I do not have a problem with that "lets just call a method"
behaviour, but I'm now having a bit of a problem in trying to figure out how
I'm supposed to discern between a "write" and a "read" action on that
function ...

Does that give you a bit more to work with ? If not, please do tell me what
you need.

Regards,
Rudy Wieser

Re: IDL - how to define and call an objects default method ? Found it.

<su0b2r$1ur1$2@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=381&group=comp.os.ms-windows.programmer.win32#381

  copy link   Newsgroups: microsoft.public.scripting.vbscript comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!aioe.org!BHGTVyTGRwF2ntnqLVfpDg.user.46.165.242.75.POSTED!not-for-mail
From: address@not.available (R.Wieser)
Newsgroups: microsoft.public.scripting.vbscript,comp.os.ms-windows.programmer.win32
Subject: Re: IDL - how to define and call an objects default method ? Found it.
Date: Wed, 9 Feb 2022 13:11:47 +0100
Organization: Aioe.org NNTP Server
Lines: 20
Message-ID: <su0b2r$1ur1$2@gioia.aioe.org>
References: <stlrao$18ah$1@gioia.aioe.org> <11xezf8j3kybx$.1b5n7cn4g91t5$.dlg@40tude.net> <stqonn$vlf$1@gioia.aioe.org> <6ztcgp3tbz71$.1pd80gla5yth$.dlg@40tude.net> <stts39$utq$1@gioia.aioe.org> <xw8d4vgh1hq1.t8tqughxioxy.dlg@40tude.net> <stuhlv$6if$2@gioia.aioe.org>
Injection-Info: gioia.aioe.org; logging-data="64353"; posting-host="BHGTVyTGRwF2ntnqLVfpDg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Response
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Notice: Filtered by postfilter v. 0.9.2
X-Priority: 3
X-MSMail-Priority: Normal
 by: R.Wieser - Wed, 9 Feb 2022 12:11 UTC

> As far as I can tell nothing goes wrong. Its just a question of how
> to handle what I'm getting presented.

It looks like I overthought/complicated the (error) results I was getting.
:-(

After some more searching and fumbling around it turns out that you can
define a property with multiple arguments just like you do a regular method.

[id(0),propget] HRESULT DefProp([in] long Arg1,[in] long Arg2,[out, retval]
long* Value); // result=object(x,y) ;(no ".DefProp" needed!)

[id(0),propput] HRESULT DefProp([in] long Arg1,[in] long Arg2,[in] long
Value); // object(x,y) = value

Regards,
Rudy Wieser

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor