Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using COMARRAY

Status
Not open for further replies.

tryn2learn

Programmer
Jun 26, 2000
24
US
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;
 
Have you tried sending 110?

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Yes I just tried 110, the result is the same error 'Function argument value, type, or count is invalid'
 
Yes, unfortunately I have tried .NULL., chr(0), and ''. Still had no luck.
 
Any other suggestions? I really need to get this to work & as far as I can tell from the help in VFP 7.0 it appears as though it should work.
 
I don't know if it will do you any good to read these threads, as far as a solutions goes, but they may offer some enlightenment. I see above you are using VFP 7 but I thought I would post them anyway:

URGENT: Class Association Cleared - Error:
thread184-767052

VFP 8.0 Bug:
thread184-773135

ComputeControlSize MonthView Control Problem
thread184-742345


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top