How To: Transfer information from Arcinfo ODE back to Delphi 3



How to transfer information back to Delphi 3 from Arcinfo ODE via the strings collection. Or, how to declare and reference the strings collection from Delphi.


To get information back from Arcinfo you need to create an automation server using CreateOleObject. First, to import the strings collection type library -under the Project menu, select import type library, then select ESRIutil Automation server from the list of type libraries and click OK. This will create an ESRIutil_TLB.pas file that must be added to Uses. CreateOleObject will be located in the ComObj.Pas unit instead of OleAuto.pas.

Make sure you use the actual interface type in your variable declaration:

result : _Strings;

{create the object}

result := _Strings(CreateOleObject('ESRIutil.Strings'));

{result can now be passed with the ARC/INFO command}
{to display the contents of the strings collection, loop from 0 (zero) to Count - 1}

ArcEdit.GetCover('* -arc',result);

{loop through result and add the items to Listbox1}

for x := 0 to result.count - 1 do
ListBox1.items.add (results.items(x));