late binding an ActiveX Executable with multiple return arrays

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JL_327

    late binding an ActiveX Executable with multiple return arrays

    No one on any of the other boards seem to know

    In VB.Net this late binding works fine


    Dim Version As Integer
    Dim Revision As Integer
    Dim Wnum As Integer
    Dim o As System.Array = System.Array.Cr eateInstance
    (GetType(Single ), 1)
    Dim h As System.Array = System.Array.Cr eateInstance
    (GetType(Single ), 1)
    Dim l As System.Array = System.Array.Cr eateInstance
    (GetType(Single ), 1)
    Dim c As System.Array = System.Array.Cr eateInstance
    (GetType(Single ), 1)
    Dim Vol As System.Array = System.Array.Cr eateInstance
    (GetType(Int32) , 1)
    Dim Dates As System.Array = System.Array.Cr eateInstance
    (GetType(Int32) , 1)



    t = CreateObject("T C2000Dev.cTC200 0")

    Wnum = 1000

    Revision = t.GetRevision
    Label1.Text() = Revision

    t.GetPrices(Wnu m, o, h, l, c, Vol, Dates, 100)

    Label2.Text() = c(1)




    When it is converted to C# late binding, the GetRevision
    method works but the GetPrices does not

    GetRevision only is suppose to return an Int32, but
    GetPrices is supposed to return multiple System.Arrays



    int WNum = 1000;

    System.Array _open = new System.Single[1];
    System.Array _high = new System.Single[1];
    System.Array _low = new System.Single[1];
    System.Array _close = new System.Single[1];
    System.Array _vol = new System.Int32[1];
    System.Array _date = new System.Int32[1];
    object[] d = {WNum, _open, _high, _low, _close, _vol,
    _date, day};


    Type myType = Type.GetTypeFro mProgID("TC2000 Dev.cTC2000");
    object myObject = Activator.Creat eInstance(myTyp e);


    //Works
    Int32 Revision = (Int32) myType.InvokeMe mber
    ("GetRevisio n",
    BindingFlags.De fault | BindingFlags.In vokeMethod,
    null,
    myObject,
    new object[]{});



    label1.Text = Revision.ToStri ng();

    //Does not work
    d = (object[]) myType.InvokeMe mber("GetPrices ",
    BindingFlags.De fault | BindingFlags.In vokeMethod,
    null,
    myObject,
    new object[]{WNum, _open, _high, _low, _close, _vol,
    _date, 100});


    How does the InvokeMember need to change to allow the
    GetPrices to work?

    WNum and 100 are the input params, and _open, _high,
    _low, _close, _vol, _date are system arrays that are
    returned

    Thanks

Working...