Dilemma of Sending a Byte Array from JavaScript to COM.

Posted by Voulnet on Stack Overflow See other posts from Stack Overflow or by Voulnet
Published on 2010-03-14T08:57:26Z Indexed on 2010/03/14 9:05 UTC
Read the original article Hit count: 438

Filed under:
|
|
|
|

Hello there, I'm having a bit of a problem because neither Javascript nor ActiveX (written in C++) are behaving like good little children. All I'm asking them to do is for Javascript to send a byte array and for the ActiveX to receive the byte array correctly in order to do more computation.

This is how I declared my byte array in JS, and I verified it inside JS:

var arr = new Array(0x00, 0xA4, 0x04, 0x00, 0x10,0xA0, 0x00, 00, 00, 0x18, 0x30, 0x03, 0x01, 00, 00, 00, 00, 00, 00, 00, 00);

Javascript sends this array as an argument to an ActiveX method. Here is the tricky part; I want the ActiveX method to receive the byte array as a SAFEARRAY or VARIANT, but I can't get it to work for the life of me.

I tried debugging and seeing the contents received inside the ActiveX as both SAFEARRAY or VARIANT, but to no avail. Here is the IDL segment:

[id(7), helpstring("NEW Sends APDU to Card and Reads the Response")]  HRESULT  NewSendAPDU( [in] VARIANT pAPDU, [out, retval]VARIANT* pAPDUResponse);

Any help is greatly appreciated. Thanks in advance!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about activex