tryn2learn
Programmer
I'm trying to send an array of information from VFP 7.0 into a Delphi object. I believe that part of my problem is that Delphi uses zero based arrays. I have tried to use the following FoxPro code, which throws an error [Function argument value, type, or count is invalid] on the line which calls the method. I'm not the owner of the Delphi code (the COM object) and cannot change the way it is written. The Delphi code is requiring that the information is to be passed in as a parameter in an array. Here’s the FoxPro Code:
**********************************************************
initobj=CreateObject("MGSysInterfaceDef.MGSysInterface")
systemobj = GETINTERFACE(initobj,"MGSysData")
Dimension a_data[2]
a_data[1] = "Search Name"
a_data[2] = ".NULL."
comarray(systemobj,111)
systemobj.SetSysData(@a_data)
**********************************************************
I have tried 111, 101, 10, 11, 0 for the comarray statement, all have the same result.The odd thing is that if I remove the @ sign from the COMARRAY line, I don’t get the foxpro error; however the Delphi code doesn’t recognize the value sent from FoxPro. The Delphi method looks like the following:
**********************************************************
procedure MGSysInterface.SetSysData(Data: OleVariant);
var
I : Integer;
vTemp : OleVariant;
begin
try
FNamedSearch := VarToStr(Data[1]);
except
FNamedSearch := '';
end;
**********************************************************
initobj=CreateObject("MGSysInterfaceDef.MGSysInterface")
systemobj = GETINTERFACE(initobj,"MGSysData")
Dimension a_data[2]
a_data[1] = "Search Name"
a_data[2] = ".NULL."
comarray(systemobj,111)
systemobj.SetSysData(@a_data)
**********************************************************
I have tried 111, 101, 10, 11, 0 for the comarray statement, all have the same result.The odd thing is that if I remove the @ sign from the COMARRAY line, I don’t get the foxpro error; however the Delphi code doesn’t recognize the value sent from FoxPro. The Delphi method looks like the following:
**********************************************************
procedure MGSysInterface.SetSysData(Data: OleVariant);
var
I : Integer;
vTemp : OleVariant;
begin
try
FNamedSearch := VarToStr(Data[1]);
except
FNamedSearch := '';
end;