I'm trying to write Amibroker COM wrapper in .net, and i stuck in 
implementation of Quotations.Retrieve method. 

I'm trying to use SafeArrays, as Tomasz said, but com exception fired.
Here is Quotations.Retrieve snippet:
int Retrieve(int Count, 
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Date,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Open,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array High,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Low,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Close,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array Volume,
            [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = 
VarEnum.VT_VARIANT)]  ref Array OpenInt);
===========
That's retrieve call:
Array D =  Array.CreateInstance(typeof(DateTime), z);
               Array O =  Array.CreateInstance(typeof(object), z);
               Array H =  Array.CreateInstance(typeof(object), z);
               Array L =  Array.CreateInstance(typeof(object), z);
               Array C =  Array.CreateInstance(typeof(object), z);
               Array V =  Array.CreateInstance(typeof(object), z);
               Array OI = Array.CreateInstance(typeof(object), z);
               int i = q.Retrieve(z, ref D, ref O, ref H, ref L, ref C, 
ref V, ref OI);
============
After invoking method, i have an exception: "Exception has been thrown by 
the target of an invocation."
============
Questions:
1. What type O,H,L,C,V,OI var should be?
2. What array size I should define, size == retrieve count or NULL size?
3. Tomasz can you send me VB 6.0 samples (Retrieve.zip)?

Best regards.




Reply via email to