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 />

1. Your first step will be to include the header file for your command or tool and<br />

update the makefile to reflect this addition.<br />

2. Next create an instance of your command or tool.<br />

// Create an instance of your command<br />

MyCommandClass* myCommand = new MyCommandClass();<br />

// Create an instance of your tool<br />

MyToolClass* myTool = new MyToolClass();<br />

3. Now place your command or tool onto your application’s toolbar.<br />

// Place the command onto the toolbar<br />

AoToolbarAddCommand(ipToolbarControl, myCommand, esriCommandStyleIconOnly);<br />

// Place the tool onto the toolbar<br />

AoToolbarAddTool(ipToolbarControl, myTool, esriCommandStyleIconOnly);<br />

Your options for the third parameter to AoToolbarAddCommand and<br />

AoToolbarAddTool are the same as they are for adding built-in commands and<br />

tools to the toolbar: esriCommandStyleIconOnly, esriCommandStyleTextOnly, and<br />

esriCommandStyleIconAndText.<br />

4. Compile your application. Your command or tool will be on the toolbar, ready<br />

for you to use it.<br />

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

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

Saved successfully!

Ooh no, something went wrong!