Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variant and SafeArray
Message
 
To
30/09/2011 08:53:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01525234
Message ID:
01525247
Views:
51
>>>Hi
>>>
>>>I have been given this VB6 code as an example:
>>>
>>>
>>>Dim AB As Object
>>>Dim qt As Object
>>>Dim aDate, aOpen, aHigh, aLow, aClose, aVolume, aOpenInt As Variant
>>>
>>>Set AB = CreateObject("Broker.Application")
>>>Set QT = AB.Stocks(Symbol.Text).Quotations
>>>
>>>NumQuotes = QT.Retrieve(-1, aDate, aOpen, aHigh, aLow, aClose, aVolume, aOpenInt)
>>>
>>>List1.Clear
>>>
>>>For i = 0 To NumQuotes - 1
>>> List1.AddItem (aDate(i) & "," & aOpen(i) & "," & aHigh(i) & "," & aLow(i) & "," & aClose(i) & "," & aVolume(i))
>>>Next
>>>
>>>
>>>
>>>So it would appear they are passing arrays to the Retrieve() function. When try it I still get type mismatch.
>>
>>Didi you tried to use COMARRAY() function?
>
>Hi Boris.
>
>I just saw that in the help but I have no idea how to use it? Never even seen it before. Any suggestions?
** passing array by reference zero based
COMARRAY(ComObject, 10)
DIMENTION aArray[10]
ComObject.SomeMethod(@aArray)

** passing array by value zero based
COMARRAY(ComObject, 0)
DIMENTION aArray[10]
ComObject.SomeMethod(@aArray)


** passing array by value one based
COMARRAY(ComObject, 1)
DIMENTION aArray[10]
ComObject.SomeMethod(@aArray)

** passing array by reference one based
COMARRAY(ComObject, 11)
DIMENTION aArray[10]
ComObject.SomeMethod(@aArray)

*** passing BYTE array by reference zero bazed
COMARRAY(ComObject, 1000 + 10)
DIMENTION aArray[10]
ComObject.SomeMethod(@aArray)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform