I have a Delphi 2006 client application. This client receives Olevariant type data from the COM server. Function:
procedure OnLimitsChanged(var SymbolsChanged: {??PSafeArray}OleVariant);
This function returns an array of strings. I can not read data like OleVariant from delphi.
From Excel VBA, it works:
Private Sub g_Realtime_OnLimitsChanged(SymbolsChanged() As String)
Dim i%
Dim Salir As Boolean
If UBound(SymbolsChanged) <> -1 Then
i = 0: Salir = False
While Not Salir
If SymbolsChanged(i) = Simbolo Then
LlamarALimites
Salir = True
Else
i = i + 1
If i > UBound(SymbolsChanged) Then Salir = True
End If
Wend
End If
End Sub
I tried converting OleVariant to Psafearray ...
procedure TfmConfiguracion.RecibirNuevosTicks(ASender: TObject;
var ArrayTicks : Olevariant);
var
Data : pSafeArray;
i,iLow, iHigh : Integer;
value : wideString;
begin
Data:=PSafeArray(TVarData(ArrayTicks).VArray);
SafeArrayGetLBound(Data,1,iLow);
SafeArrayGetUBound(Data,1,iHigh);
for i:=iLow to iHigh do
begin
SafeArrayGetElement(Data,i,Value);
Showmessage(Value);
end;
But I only get on this line:
SafeArrayGetLBound(Data,1,iLow);
Debugger failure notification
Project ... with an error with the message: "Access violation on 0x751de18c: reading address 0xabababab". Cork process. Use the "Step" or "Run" button to continue.
Any advice and suggestions are welcome.
source
share