Passing values by reference from java / vb script to ActiveX object 
Author Message
 Passing values by reference from java / vb script to ActiveX object

Hi,

I'm accessing my activeX object in a web page via javascript.  I want to
avoid using VBScript to keep my page available to netscape users, but I do
experience the same problem if I use vbscript.

Now, I want my object's methods to return values back to the script.  The
way I'm trying to do this is:

[script] passing variables as an argument of a method:
 myobject.getID( nId );

[activeX object]    the argument is an [out]: HRESULT getID([out]int *nId);
                            and gets filled in something like:  *nId = 5;

Invariably, the valud nId in the script returns from the method with the
value 'undefined'.  The same process works in VB, which leads me to believe
it may be a problem with the variable types (no early binding!).

Can someone explain the problem, and maybe suggest a way round it?

Thanks for any help,
Simon.




Sun, 21 Oct 2001 03:00:00 GMT  
 Passing values by reference from java / vb script to ActiveX object
It should be either [out, retval] or [in, out] VARIANT* and the passed
VARIANT contains VT_BYREF | VT_VARIANT. This is for the simple
fact that VBScript (maybe JavaScript too?) supports ONLY VARIANT
type for its variables. They are smart enough to encapsulate the
returned value, but not when you pass the VBScript variable directly.
Also, they don't support [out] only parameters.

--
===============================
Alexander Nickolov
STL Panasonic

===============================


Quote:
>Hi,

>I'm accessing my activeX object in a web page via javascript.  I want to
>avoid using vbscript to keep my page available to netscape users, but I do
>experience the same problem if I use vbscript.

>Now, I want my object's methods to return values back to the script.  The
>way I'm trying to do this is:

>[script] passing variables as an argument of a method:
> myobject.getID( nId );

>[activeX object]    the argument is an [out]: HRESULT getID([out]int *nId);
>                            and gets filled in something like:  *nId = 5;

>Invariably, the valud nId in the script returns from the method with the
>value 'undefined'.  The same process works in VB, which leads me to believe
>it may be a problem with the variable types (no early binding!).

>Can someone explain the problem, and maybe suggest a way round it?

>Thanks for any help,
>Simon.





Sun, 21 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing values by reference from java / vb script to ActiveX object

2. How can pass a value from Vb script to java script

3. Passing an object reference by reference where the object has a default property

4. activex control and passing values by reference

5. Pass by reference from ActiveX to J-Script?

6. Passing references to ActiveX Exe object

7. Passing object Reference with ActiveX EXE

8. Passing object Reference with ActiveX EXE

9. Passing Object References from Application to Script Code

10. passing references to COM objects in script

11. Passing Value to VB Script

12. passing active x control reference to com.dll created in java

 

 
Powered by phpBB® Forum Software