18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C++ APPLICATION PROGRAMMING INTERFACE<br />

ARCGIS DEVELOPMENT IN THE VISUAL STUDIO 6.0 IDE<br />

The ArcSDK.h and <strong>ArcGIS</strong> <strong>Engine</strong> OLB files are<br />

installed in the \include\CPPAPI and \com folders, respectively.<br />

Setting up your application<br />

To begin creating your <strong>ArcGIS</strong> <strong>Engine</strong> application in Visual Studio 6.0, start<br />

Microsoft Visual C++ and use the Win32 Console Application wizard to create<br />

an empty project. Click File > New > Win32 Console Application, type in the<br />

name of the project, and choose its location.<br />

Next, set the required project options. On the C/C++ tab of the Project Menu ><br />

Settings dialog box, click Preprocessor from the Category combo box. In the<br />

Additional Include Directories text box, type the path to ArcSDK.h. In addition,<br />

type in the location of the <strong>ArcGIS</strong> <strong>Engine</strong> OLB files. Don’t forget to separate the<br />

two paths with a semicolon.<br />

Go to the Preprocessor Definitions text box and type “ESRI_WINDOWS” to<br />

define the ESRI_WINDOWS symbol. Similar to the include directories, symbols<br />

need to be separated with commas.<br />

It is recommended that you use the /GX and /NOLOGO compiler flags. /GX<br />

enables synchronous exception handling, and /NOLOGO prevents display of a<br />

compiler startup banner and informational compiler messages. Activate /GX by<br />

opening the project Property Pages, navigating to C/C++ > C++ Language, and<br />

checking Enable exception handling. Set /NOLOGO by checking the Suppress<br />

Startup Banner and Information Messages option from the menu bar, Project ><br />

Settings > C/C++ tab > Customize category.<br />

Finally, go to Project > Add to Project > New to add some files to the project;<br />

these will eventually contain your code. Select the type of file you want to add<br />

and give it a name. Add as many files as you need for your application. You are<br />

ready to write your code. Don’t forget to start by including ArcSDK.h!<br />

Compiling your application<br />

To compile an <strong>ArcGIS</strong> <strong>Engine</strong> application in Visual Studio 6.0, press F7 or click<br />

Build > Build YourApplicationName.exe.<br />

Running your application<br />

Before you can run an <strong>ArcGIS</strong> <strong>Engine</strong> command-line application from within<br />

Visual Studio 6.0, you need to set up the arguments. Arguments are added to your<br />

program by customizing your project settings; go to the Project menu > Settings<br />

> Debug tab and add any arguments to the Program arguments text box.<br />

Once the arguments are added, run the application by clicking Build > Execute<br />

YourApplicationName.exe or by pressing Ctrl+F5. To run the application in<br />

debug mode, click Build > Start Debug > Go, or press F5.<br />

ARCGIS DEVELOPMENT IN THE VISUAL STUDIO .NET 2003 IDE<br />

Setting up your application<br />

The easiest way to program with the C++ API in .NET is to use the C/C++<br />

Console Application wizard. This wizard is not the same as the Win32 Console<br />

Project and Console Application (.NET) wizards. To access the C/C++ Console<br />

Application wizard, you must install Academic Tools for VS .NET 2003. This is<br />

available from the downloads page at http://msdn.microsoft.com/academic/<br />

Chapter 4 • <strong>Developer</strong> environments • 213

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!