How does the ActiveX control written by Delphi return an array to VBScript/JavaScript?

Source: Internet
Author: User
Tags javascript array
How to return an array of ActiveX controls written in Delphi to VBScript/JavaScript Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiAPI/html/delphi_20061120161640191.html

Everybody, it is easy to use Vbscript to call ActiveX to send a variant parameter. The content is an array, but in turn it has never been successful. Who knows how to implement the Delphi ActiveX Control to send the array content to VBScript? Thank you!

Javascript can also ......

That is, how to implement complex data interaction between scripts and ActiveX

Thanks

The returned values of Delphi functions do not seem to support arrays.

I have been confused about this problem for a long time. In fact, arrays in JavaScript are not safearray, not Delphi arrays converted to vararray compatible types. They are COM objects that support double interfaces, I have been searching for a long time and have not found the Type Library of this object. I think I can write a class that supports double interfaces, and it is enough to include a public method of JavaScript array. However, there is another problem. I don't know how to convert the indexer (for example, FG [2]) in Javascript. This cannot be found for a long time.
it is depressing. In the end, you have to include a parameter in the call function. The parameter type is the idispatch interface, and then input new array () in JavaScript (). Use the invoke of idispatch to call the method of this array object to add the value.
I am crazy.
I am crazy. I really don't know where the JavaScript Object Type Library is. Msdn cannot be found.

later, I do not need to transmit arrays.
I can get browsor from ActiveX, get document, and then let document execute a script. He has a method called invokescript, and I will call this method, run New array () with eval (). Get the returned JS array object.
later, I used this method to create compatible JS objects, except for the basic value types.
I added the attachevent and detachevent methods to my ActiveX object. In this way, JavaScript can respond to ActiveX events in a customary way, instead of using the event-type script Code segment. I used a list internally to support multicasting.
later, my ActiveX object was about the same as the standard built-in JS object. Oh, of course, there was no standard method. In fact, it was due to the flexibility of idispatch. His later binding and name-based binding policies are indeed good.
In fact, idispatch does not reject reload. It is only a compiled language such as Delphi. The runtime type information is incomplete and does not contain the list of function parameters. Therefore, later binding cannot be implemented.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.