Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

If at first you don't succeed, you must be a programmer.


devel / comp.os.ms-windows.programmer.win32 / Re: OCX (ActiveX) returning of multiple floats

SubjectAuthor
* OCX (ActiveX) returning of multiple floatsR.Wieser
+* OCX (ActiveX) returning of multiple floatsPaul N
|`- OCX (ActiveX) returning of multiple floatsR.Wieser
`* OCX (ActiveX) returning of multiple floatsJJ
 +- OCX (ActiveX) returning of multiple floatsJJ
 `- OCX (ActiveX) returning of multiple floatsR.Wieser

1
OCX (ActiveX) returning of multiple floats

<ubibj4$39ehf$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=634&group=comp.os.ms-windows.programmer.win32#634

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: address@is.invalid (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: OCX (ActiveX) returning of multiple floats
Date: Wed, 16 Aug 2023 13:22:54 +0200
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <ubibj4$39ehf$1@dont-email.me>
Injection-Date: Wed, 16 Aug 2023 11:23:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4882e6bb77cfa2db95c279accdda4e33";
logging-data="3455535"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/DuJV0T+EtTQkQBR+dHAQIx8GEGkFHfVLiyLHsXpKsuA=="
Cancel-Lock: sha1:ugBhy+VgimTbR0zcfyq4XuAO7/E=
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-MSMail-Priority: Normal
 by: R.Wieser - Wed, 16 Aug 2023 11:22 UTC

Hello all,

I've got an OCX/ActiveX object which has a method which is, in the IDL file,
described as follows :

HRESULT SetData([in] float val1,[in] float val2,[in] float val3);

I just tried to write a method to retrieve that data again, and its
descriptione looks like this :

HRESULT GetData([in] float* val1,[in] float* val2,[in] float* val3);

When I try to call the methods from within VBScript like this :

call oData.SetData(1,2,3)

call oData.GetData(v1,v2,v3)
-or-
oData.GetData v1,v2,v3

the "SetData" one works, but for some reason the "GetData" ones (both)
generate an "type mismatch" error (and the methods code in the OCX doesn't
get called).

My question : what should the "GetData" description in the IDL look like ?

Remark :
I got the "GetData" method to work by changing the "float*" to "variant*"
(and change the called method accordingly), but would like to have both
methods and arguments to be copies of each other - just working in opposite
directions.

Regards,
Rudy Wieser

Re: OCX (ActiveX) returning of multiple floats

<11c7f7c3-4687-476f-90a6-5fd720ef59a6n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=635&group=comp.os.ms-windows.programmer.win32#635

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
X-Received: by 2002:a37:5a41:0:b0:76c:d42d:3537 with SMTP id o62-20020a375a41000000b0076cd42d3537mr24098qkb.13.1692194160056;
Wed, 16 Aug 2023 06:56:00 -0700 (PDT)
X-Received: by 2002:a17:902:e749:b0:1bc:6f8c:7c15 with SMTP id
p9-20020a170902e74900b001bc6f8c7c15mr791597plf.7.1692194159827; Wed, 16 Aug
2023 06:55:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.ms-windows.programmer.win32
Date: Wed, 16 Aug 2023 06:55:59 -0700 (PDT)
In-Reply-To: <ubibj4$39ehf$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.28.27.182; posting-account=0B-afgoAAABP6274zLUJKa8ZpdIdhsYx
NNTP-Posting-Host: 92.28.27.182
References: <ubibj4$39ehf$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <11c7f7c3-4687-476f-90a6-5fd720ef59a6n@googlegroups.com>
Subject: Re: OCX (ActiveX) returning of multiple floats
From: gw7rib@aol.com (Paul N)
Injection-Date: Wed, 16 Aug 2023 13:56:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 61
 by: Paul N - Wed, 16 Aug 2023 13:55 UTC

On Wednesday, August 16, 2023 at 12:23:20 PM UTC+1, R.Wieser wrote:
> Hello all,
>
> I've got an OCX/ActiveX object which has a method which is, in the IDL file,
> described as follows :
>
> HRESULT SetData([in] float val1,[in] float val2,[in] float val3);
>
> I just tried to write a method to retrieve that data again, and its
> descriptione looks like this :
>
> HRESULT GetData([in] float* val1,[in] float* val2,[in] float* val3);
>
> When I try to call the methods from within VBScript like this :
>
> call oData.SetData(1,2,3)
>
> call oData.GetData(v1,v2,v3)
> -or-
> oData.GetData v1,v2,v3
>
> the "SetData" one works, but for some reason the "GetData" ones (both)
> generate an "type mismatch" error (and the methods code in the OCX doesn't
> get called).
>
> My question : what should the "GetData" description in the IDL look like ?

I don't know VBScript at all, so I can't give you the full answer, but the problem seems to be that in SetData you simply pass in the values you want to use, whereas with GetData you pass in pointers - that is to say, you are telling it where to put the answers. In C, oData.GetData(v1,v2,v3) would try to pass in the values of v1 etc, and you would need to change it to oData.GetData(&v1,&v2,&v3) to tell it to pass in addresses. Presumably VBScript has something similar. You'll need to check what it is and use it.

> Remark :
> I got the "GetData" method to work by changing the "float*" to "variant*"
> (and change the called method accordingly), but would like to have both
> methods and arguments to be copies of each other - just working in opposite
> directions.

The raw SetData and GetData functions are not quite quite "copies of each other" as one takes pointers and the other doesn't, but presumably you could write a "wrapper" function around them if you wanted to to make them similar. For instance in C++:

void mySetData(something &o, float* val1, float* val2, float* val3) { o.SetData(*val1, *val2, *val3); } // asterisks to read the values at the pointers

void myGetData(something &o, float* val1, float* val2, float* val3) { o.GetData(val1, val2, val3); } // here we want to just pass on the pointers

Hope that is useful!
Paul.

Re: OCX (ActiveX) returning of multiple floats

<10n6jilwltavz$.z86qb84c17dt$.dlg@40tude.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=636&group=comp.os.ms-windows.programmer.win32#636

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jj4public@outlook.com (JJ)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: OCX (ActiveX) returning of multiple floats
Date: Wed, 16 Aug 2023 22:15:05 +0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <10n6jilwltavz$.z86qb84c17dt$.dlg@40tude.net>
References: <ubibj4$39ehf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="6bc448e5391d3290d5fdc4c5de1dae9c";
logging-data="3521807"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TC89aeGKP7+XQvuKmSpcNPymF/E1DxCc="
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:G6f/aSaoYD4CZYJ7PKEE5NigFLU=
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
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
 by: JJ - Wed, 16 Aug 2023 15:15 UTC

On Wed, 16 Aug 2023 13:22:54 +0200, R.Wieser wrote:
>
> HRESULT GetData([in] float* val1,[in] float* val2,[in] float* val3);

That should be defined as:

HRESULT GetData([in, out] float* val1,[in, out] float* val2,[in, out] float*
val3);

Otherwise, the function will get the pointer to the copy of the given
values. Because VBScript can not specifically pass a function argument by
reference. e.g. this will cause a syntax error:

retVal = obj.GetData(byref v1, byref v2, byref v3)

In VBScript, the use of `byref` operator outside of a subroutine/function
declaration, is not available. It's only available in VB/VBA.

Re: OCX (ActiveX) returning of multiple floats

<1jmuexplja4x1.s5shyvj6aasp.dlg@40tude.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=637&group=comp.os.ms-windows.programmer.win32#637

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jj4public@outlook.com (JJ)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: OCX (ActiveX) returning of multiple floats
Date: Wed, 16 Aug 2023 22:18:46 +0700
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <1jmuexplja4x1.s5shyvj6aasp.dlg@40tude.net>
References: <ubibj4$39ehf$1@dont-email.me> <10n6jilwltavz$.z86qb84c17dt$.dlg@40tude.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="6bc448e5391d3290d5fdc4c5de1dae9c";
logging-data="3521807"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DwdIP8012smOPOt1tQG7wwop1ioXRKos="
User-Agent: 40tude_Dialog/2.0.15.84
Cancel-Lock: sha1:FTeaPFY+LTUkzZYxwxWdHVhE/ak=
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 - Wed, 16 Aug 2023 15:18 UTC

On Wed, 16 Aug 2023 22:15:05 +0700, JJ wrote:
> On Wed, 16 Aug 2023 13:22:54 +0200, R.Wieser wrote:
>>
>> HRESULT GetData([in] float* val1,[in] float* val2,[in] float* val3);
>
> That should be defined as:
>
> HRESULT GetData([in, out] float* val1,[in, out] float* val2,[in, out] float*
> val3);
>
> Otherwise, the function will get the pointer to the copy of the given
> values. Because VBScript can not specifically pass a function argument by
> reference. e.g. this will cause a syntax error:
>
> retVal = obj.GetData(byref v1, byref v2, byref v3)
>
> In VBScript, the use of `byref` operator outside of a subroutine/function
> declaration, is not available. It's only available in VB/VBA.

IDL example for a method which uses its multiple arguments as output is the
IWebBrowserApp::ClientToWindow, which is defined in SHDOCVW.DLL's type
library.

Re: OCX (ActiveX) returning of multiple floats

<ubipn0$3bi7u$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=638&group=comp.os.ms-windows.programmer.win32#638

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: address@is.invalid (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: OCX (ActiveX) returning of multiple floats
Date: Wed, 16 Aug 2023 17:24:01 +0200
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <ubipn0$3bi7u$1@dont-email.me>
References: <ubibj4$39ehf$1@dont-email.me> <11c7f7c3-4687-476f-90a6-5fd720ef59a6n@googlegroups.com>
Injection-Date: Wed, 16 Aug 2023 15:24:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4882e6bb77cfa2db95c279accdda4e33";
logging-data="3524862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ddi6Nasc3gNFaCSzNIeWtOfrI/q3BghAqm/Y7NflQZg=="
Cancel-Lock: sha1:nK3JeUiAzpXiTdkX/gKUa4i/kOQ=
X-RFC2646: Format=Flowed; Original
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MSMail-Priority: Normal
 by: R.Wieser - Wed, 16 Aug 2023 15:24 UTC

Paul,

> I don't know VBScript at all,

Thats a bit of a problem.

You see, in VBScript /all/ variables are variants, converted to whatever is
needed by the OCX objects methods by a translation layer. When my SetData
code requires three floats the in the VBScript code provided variant
arguments are taken by the translation layer and from whetever data is in
them (floats, ints, strings, bools, etc, null, empty) a float is extracted
(silent conversion) and passed on.

IOW, all data in VBScript is, AFAIK, provided to the translation layer "by
ref" (wrapped in a variant).

.... and that is why I don't quite get why it works one way, but not the
other ...

> In C .... you would need to change it to oData.GetData(&v1,&v2,&v3) to
> tell it to pass
> in addresses.

That is how it works for C, yes. In VBScript the called method specifies
how it wishes to receive an argument, and its passed accordingly.

> The raw SetData and GetData functions are not quite quite "copies of each
> other"

:-) If they where I would not have written those twice. I'm a (hobby)
programmer, and as such lazy by definition. :-)

The "sting" is in the part after it, "just in the other direction" (one
accepts data, the other returns it). Maybe "mirror copies" would have been
a better description.

Regards,
Rudy Wieser

Re: OCX (ActiveX) returning of multiple floats

<ubj5i7$3dfg3$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=639&group=comp.os.ms-windows.programmer.win32#639

  copy link   Newsgroups: comp.os.ms-windows.programmer.win32
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: address@is.invalid (R.Wieser)
Newsgroups: comp.os.ms-windows.programmer.win32
Subject: Re: OCX (ActiveX) returning of multiple floats
Date: Wed, 16 Aug 2023 20:46:07 +0200
Organization: A noiseless patient Spider
Lines: 79
Message-ID: <ubj5i7$3dfg3$1@dont-email.me>
References: <ubibj4$39ehf$1@dont-email.me> <10n6jilwltavz$.z86qb84c17dt$.dlg@40tude.net>
Injection-Date: Wed, 16 Aug 2023 18:46:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4882e6bb77cfa2db95c279accdda4e33";
logging-data="3587587"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Ozs9tu6fTDN4fB0twRSeHZavM3JnFRsI/OFne0HOO4w=="
Cancel-Lock: sha1:OYZDVHR3plPLV93qId5pW475Tyg=
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
 by: R.Wieser - Wed, 16 Aug 2023 18:46 UTC

JJ,

> That should be defined as:
>
> HRESULT GetData([in, out] float* val1,[in, out] float* val2,[in, out]
> float* val3);

When I tried that (and just now re-tried to make sure) it gave me the same
"type mismatch" error (not even trying to execute the OCX methods code)

> Otherwise, the function will get the pointer to the copy of the
> given values.

First, the VBScript doesn't even get that far. It rejects the call itself.

Second, why the copy ? As far as I can tell the translation layer
/should/ be able to just point into the provided variant, setting its type
to the one specified in the IDL description and just let the OCX code write,
thru the pointer, whatever it wants into it.

And as I mentioned in my remark section, changing the type from"float*" to
"variant*" suddenly gets everything to work, even though I have just "[out]"
and not "[in, out]"

IOW, this works:

HRESULT GetData([out] variant* val1,[out] variant* val2,[out] variant*
val3);

but this doesn't.

HRESULT GetData([out] float* val1,[out] float* val2,[out] float* val3);

and I do not see any reason why.

..... :-(

I just noticed in my initial post that I in the "GetData" definition used
"[in]" where I should (ofcourse) have said "[out]" - I copy-pasted the
(anonimized) "SetData" definition and changed its name but forgot to do the
same with its direction. :-|

My apologies.

> IDL example for a method which uses its multiple arguments as output is
> the IWebBrowserApp::ClientToWindow, which is defined in SHDOCVW.DLL's
> type library.

This is the IDLs information of the the first argument of that
IWebBrowserApp::ClientToWindow method:

TypeDesc : 001A - PTR 00000000 0016 - INT
ParamDesc : 0003 - IN OUT

This is the first argument of my GetData method (using your in, out)

TypeDesc : 001A - PTR 00000000 0004 - R4 (Float)
ParamDesc : 0003 - IN OUT

The only difference seems to be Int versus Float

I rewrote my GetData definition to exactly mimic the ClientToWindow one

TypeDesc : 001A - PTR 00000000 0016 - INT
ParamDesc : 0003 - IN OUT

, but it still fails. I would like to have been able to test that
ClientToWindow, but I have no idea how/where to use it. Do you happen to
know of some certain-to-work bit of VB script ?

.... Currently I'm starting to get the feeling that VBScript refuses any "by
reference" argument type, but for a variant (and possibly a BStr. Haven't
tested that one yet).

Regards,
Rudy Wieser

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor