0

I need to pass an associative array from Javascript to a C++ activex control in IE6+. It seems a shame to write my own type for something so standard. It doesn't have to work with native JS objects, I can use a custom associative array type if I need.

I've been googling for a couple days and there isn't a lot of information on this subject. COM and ATL have to have this already, don't they?

1 Answer 1

1

This post by Eric Lippert may shed some light on how it could be done from C++. Take a look at his comments about a Javascript array being a Dispatch object. As such you could get the DISPIDs and call Invoke on each one. Another option is to convert the Javascript array to a SafeArray using VBArray (and a little VBScript), or you could just use the Scripting.Dictionary COM object, which is the equivalent of an associative array. A few resources are below.

Link

http://www.java2s.com/Tutorial/JavaScript/0600__MS-JScript/DictionaryKeys.htm

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.