Chris Stebbing wrote: > I'm struggling through this automation project that I'm in the middle > of. I need a Delph program to talk to an application which is a .net > application and I have no idea what language it was written in.
It's COM, and it's .Net. Two things that make language irrelevant. > The > application has installed a COM server on my machine, and I have > imported the type library via Delphi but I'm stuck on grabbing data > from the COM server. > > I have gone with > baCom := CreateComObject(CLASS_ComClass) as ComClass; > > which works. I can control the other application using methods that > require a simple integer (or no) argument. > > however, the method GetSports returns an array of objects of type > _bfsport. I know that this is a record with two fields > sport : String; > sportid : Integer; No, it's not a record. COM can't marshal records. You sure it's not an interface with two properties and accessor methods? And it's not a string. Only Delphi knows string. More likely it's a WideString. Also, it might not be a real array. Are you sure it's not a variant array? > I have declared two variables, > sports : Array of BfSport; > mysport : BfSport; Are _bfsport and BfSport the same things? > I use > sports := baCom.GetSports; > > and this works. sports is filled with an array of pointers to > objects of type _bfsport. How have you checked that? How do you know that GetSports has really returned a Delphi-compatible dynamic array, and how do you know that the things in that array are really pointers, and how do you know that those pointers are pointing to _bfsports? Just because the line compiled and ran doesn't mean any of that was true. I'm asking because I'm pretty sure a real COM function never returns a dynamic array. Maybe a Delphi _wrapper_ of a COM function would, though. The code you've posted has been absent of declarations. > however, I can't access the data in those objects. I can use > mysport := sports[1]; > > and the compiler likes it and it seems to work, but then I can't do > mysport.sport > the compiler complains about sport not being declared. Well, is it? -- Rob _______________________________________________ Delphi mailing list -> [email protected] http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

