How to convert a byte array from ActiveX control to an Array object - Javascript

This is a discussion on How to convert a byte array from ActiveX control to an Array object - Javascript ; Hello Everyone, In my javascript, an ActiveX control returns a byte array, say block. But by any means I just can not access it. The typeof operator says its time is unknown, any call to this object will fail, either ...

+ Reply to Thread
Results 1 to 2 of 2

How to convert a byte array from ActiveX control to an Array object

  1. Default How to convert a byte array from ActiveX control to an Array object

    Hello Everyone,

    In my javascript, an ActiveX control returns a byte array, say block. But by
    any means I just can not access it. The typeof operator says its time is
    unknown, any call to this object will fail, either toArray or toString. Of
    course, indexing by [] will fail. Then I tried type casting in the way I
    know:

    var test = (Object) block;
    var test = (Array) block;
    var test = (byte[]) block;
    var test = (Object[]) block;
    var test = (String)block;

    But seems javascript doesn't support casting in that way. So I tried to
    contruct object from that:

    var test = new Object(block);
    var test = new Array(block);
    var test = new String(block);

    But none of above let me access the bytes inside the array.

    Is there anyone successed in getting a byte array from an ActiveX control?

    Thanks,
    Lei Lei Shi


  2. Default Re: How to convert a byte array from ActiveX control to an Arrayobject

    Lei Lei Shi wrote:
    > Hello Everyone,
    >
    > In my javascript, an ActiveX control returns a byte array, say block.
    > But by any means I just can not access it. The typeof operator says its
    > time is unknown, any call to this object will fail, either toArray or
    > toString. Of course, indexing by [] will fail. Then I tried type casting
    > in the way I know:
    >
    > var test = (Object) block;
    > var test = (Array) block;
    > var test = (byte[]) block;
    > var test = (Object[]) block;
    > var test = (String)block;
    >
    > But seems javascript doesn't support casting in that way. So I tried to
    > contruct object from that:
    >
    > var test = new Object(block);
    > var test = new Array(block);
    > var test = new String(block);
    >
    > But none of above let me access the bytes inside the array.
    >
    > Is there anyone successed in getting a byte array from an ActiveX control?
    >
    > Thanks,
    > Lei Lei Shi

    Try
    var test = eval("'" + block + "'");

    at least do an

    alert(block);

    Hope this helps

+ Reply to Thread

Similar Threads

  1. convert byte array to unicode?
    By Application Development in forum PHP
    Replies: 3
    Last Post: 11-07-2007, 09:11 AM
  2. Replies: 1
    Last Post: 07-26-2007, 10:03 AM
  3. How o convert BufferedImage object to byte array
    By Application Development in forum Java
    Replies: 1
    Last Post: 03-13-2007, 07:13 AM
  4. Are there any pure managed object to Byte Array methods?
    By Application Development in forum DOTNET
    Replies: 3
    Last Post: 11-06-2006, 12:25 PM
  5. Convert string to byte array
    By Application Development in forum CSharp
    Replies: 2
    Last Post: 01-25-2006, 07:00 AM