Programming ArcObjects 10.1 with Embarcadero Delphi XE2

4097
6
10-01-2012 11:38 AM
RogerDunn
Occasional Contributor II
Since Delphi 2009, 2010, and XE couldn't deal with COM very well, I never published any how-to documents on programming ArcObjects with those IDE's.  However, XE2 does a fine job, so I have rewritten the document from scratch and included a sample project.  The download is here:

http://www.arcgis.com/home/item.html?id=12b751a0413c4e8fad9d45ad690609b2

"Roj"
0 Kudos
6 Replies
RichardMorey
New Contributor
HI --

I am interested in trying to get ArcObjects working with Delphi XE5 so I wanted to use your instructions as a guide but it says I don't have access to the document.

I also saw a similar (or the same?) document on Scribd but I have to pay for access to that version.

Is this document available somewhere?

Thanks

Rich
0 Kudos
RogerDunn
Occasional Contributor II
I don't understand.  It has 188 downloads, and it's shared with Everyone, but I'll try re-sharing it and see if that helps...Done.

I also have Delphi XE5, but I have not updated the documents for any versions of Delphi since XE2.

I would recommend making your own little batch file that goes like this:


set ArcGISHome="%ProgramFiles(x86)%\ArcGIS\Desktop10.2\com\"
set DelphiDir="%ProgramFiles(x86)%\Embarcadero\RAD Studio\12.0\Bin\"
set ImportDir="%UserProfile%\Documents\RAD Studio\12.0\Projects\Packages\ArcObjects"
if not exist %ImportDir% mkdir %ImportDir%
for %%A in (%ArcGISHome%*.olb %ArcGISHome%*.tlb %ArcGISHome%*.ocx) do %DelphiDir%tlibimp.exe -P+ -D%ImportDir% -Hs- -Hpa"ArcObjects" -Pt+ -R- "%%A"


Make sure you assign the variables properly, and change it whenever you have a new version of ArcGIS or Delphi.  You can also go with hard-coded paths if that makes you feel more comfortable.  Also take the (x86) out when ArcGIS moves to 64-bit or Delphi does.

You'll add the resulting .pas files to a Delphi package, and fix up some of the things that can't be compiled because of type incompatibilities (always believe the method return type or parameter type, not the property type).  Once it compiles you can install it and you may or may not get any components on your palette.  I don't know how ArcGIS Engine works but I would imaging it would put quite a few components on your palette.  But doing this enables me to create tools for use in ArcMap and ArcCatalog.

Let me know if you still can't access the document.

"Roj"
0 Kudos
RichardMorey
New Contributor
Thanks so much. I was able to get to the document this time. I did get most of the work done without your help but the compile errors appendix will be key!

Rich
0 Kudos
PhilipHughes
New Contributor III

Hi

Am trying to develop using Delphi XE, in your document you comment about batch file to import the com objects,  is this available to download anywhere.

regards

Phil

0 Kudos
RogerDunn
Occasional Contributor II

As I mentioned a few posts back, Delphi XE didn't deal with COM very well at all.  The support was so bad, that I didn't make any documents about it and ArcObjects.  However, since XE 2 (up to, and including, XE 6), COM and ActiveX support in Delphi has been really good.  There are two reasons I haven't updated this document in those years: 1) a lack of time on my part and 2) the instructions are pretty much the same for those versions.

I don't know if and how my Delphi/ArcObjects documents are available on other sites, but I've shared this document with everyone and everyone on this site should be able to download it.  Maybe you have to log in to ESRI or something, but the registration's free.

I don't know where ArcGIS Desktop is going in terms of COM and ActiveX support.  Since the "VBA" help has stopped being updated, my guess is that ESRI will stop (or has stopped) supporting COM connectivity and supports .NET development more officially.  Delphi and .NET only go together with Oxygene (which has another name now) and I don't think I'll go down that path.

"Roj"

0 Kudos
PhilipHughes
New Contributor III

Thank you

Am returning to delphi after number of years

Kind regards

Phil

Sent from my iPad

0 Kudos