Hello,

I would like to create a static object in AFL and after send this 
pointer (called IDispatch type variable) to a Visual Basic 
COM/ActiveX DLL.
After i would like to call this object created in AFL amibroker from 
the VB code.

I need to use VB code because the COM object created fom AFL return 
matrix, so i need to change the result to array before sending it 
back to Amibroker.
And another purpose of this is that create.object is long because it 
is a heavy object, so during recursion with multiple call to the VB 
code in AFL it is really slow. I would like to create the object just 
one time with amibroker, and after call directly the method from 
Visual Basic without create a new object.

The code i use are :

AFL code :
------------------------------------------
aClass = CreateObject("carre.carreclass"); //object to be called in 
the VB code, we can use CreateStaticObject too here
myobj = CreateObject("Project1.Class1"); // VB COM/ActiveX DLL
_TRACE("aClass:"+aClass); // return IDispatch type variable
_TRACE("myobj:"+myobj); // return IDispatch type variable

result = myobj.test(200, aClass);
------------------------------------------

VB code :
------------------------------------------
Public Function testVB(n As Variant, aClass As Variant) As Variant
'IF I DEBUG HERE "aClass" is empty !!
    Dim matrix As Variant
    Dim result() As Variant
    
    Call aClass.fct1(matrix, n)

... processing matrix variable and VB code here ...
    
' IF I SEND BACK testVB = aClass to amibroker, a _trace under 
amibroker no more say that variable is IDispatch, but say it is 
empty !!

    testVB = result

End Function
------------------------------------------


Any help is welcome ! Thanks.

Cheers,
Mich




Reply via email to