18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C++ APPLICATION PROGRAMMING INTERFACE<br />

For the sake of simplicity the code snippets given<br />

don’t always check HRESULTs, although as a<br />

developer you should always do so.<br />

RECOMMENDED FUNCTION USAGE<br />

The C++ API provides its own implementation of some functions. Below are the<br />

names and descriptions of the general API functions and examples of their use.<br />

For additional information on the Motif- and GTK-specific functions, see the<br />

sections ‘Motif <strong>ArcGIS</strong> control programming’ and ‘GTK <strong>ArcGIS</strong> control programming’,<br />

respectively.<br />

General API functions (described below)<br />

• AoInitialize<br />

• AoUninitialize<br />

• AoExit<br />

• AoCreateObject<br />

• AoAllocBSTR<br />

• AoFreeBSTR<br />

• AoToolbarAddCommand<br />

• AoToolbarAddTool<br />

Motif-specific API functions<br />

• MwCtlAppMainLoop<br />

• MwCtlGetInterface<br />

GTK-specific API functions<br />

• gtk_axctl_new<br />

• gtk_axctl_get_interface<br />

• gtk_axctl_initialize_message_queue<br />

AoInitialize, AoUninitialize, and AoExit<br />

• AoInitialize—used where CoInitialize would be used in COM programming.<br />

extern "C" HRESULT AoInitialize(LPVOID pvReserved);<br />

This function initializes <strong>ArcGIS</strong> <strong>Engine</strong>. The initialization must be done prior<br />

to ArcObjects being used and in addition to the use of the IAoInitialize interface,<br />

which handles licensing for the application.<br />

• AoUninitialize—used where CoUninitialize would be used in COM programming.<br />

extern "C" void AoUninitialize(void);<br />

This function uninitializes <strong>ArcGIS</strong> <strong>Engine</strong>.<br />

• AoExit—used where exit would be used in non-ArcObjects code, as well as<br />

where return would be used in main.<br />

extern "C" VOID AoExit (int number);<br />

AoExit must be called before an application is exited. This allows portability<br />

to supported operating systems that require AoExit to correctly clean up<br />

various <strong>ArcGIS</strong> <strong>Engine</strong> elements.<br />

224 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!