Hi All, thanks for reading the post.
In my latest project, I'm trying to access a Method in a type library that requires a PSafeArray as one of its arguments (via COM interface).
Thus far, I have loaded a text file into an Array of doubles but now I am unable to pass it to the method.
the function i'm using is as below:
Function TForm1.BeamTempratureCalc (Periods: Integer): Double;
var
COM_Method_Data: PSafeArray; //to be sent to the method
Tmp: TempCalc;
begin
COM_Method_Data:=Addr(TempArray); //TempArray is an array of double
COM_Method_Data:=SafeArrayCreateVector(vt_R8,0,Periods);
COM_Method_Data.pvdata:=@COM_Method_Data;
Tmp:=coTempCalc.create;
BeamTempratureCalc:=Tmp.RateOfChange(COM_Method_Data,Periods);
Does anyone have any experience or advice for this kind of problem?
many thanks, Kay
In my latest project, I'm trying to access a Method in a type library that requires a PSafeArray as one of its arguments (via COM interface).
Thus far, I have loaded a text file into an Array of doubles but now I am unable to pass it to the method.
the function i'm using is as below:
Function TForm1.BeamTempratureCalc (Periods: Integer): Double;
var
COM_Method_Data: PSafeArray; //to be sent to the method
Tmp: TempCalc;
begin
COM_Method_Data:=Addr(TempArray); //TempArray is an array of double
COM_Method_Data:=SafeArrayCreateVector(vt_R8,0,Periods);
COM_Method_Data.pvdata:=@COM_Method_Data;
Tmp:=coTempCalc.create;
BeamTempratureCalc:=Tmp.RateOfChange(COM_Method_Data,Periods);
Does anyone have any experience or advice for this kind of problem?
many thanks, Kay