2.4. Cleaning Up After You're DoneThe MapPoint 2004 object model was originally designed and implemented using COM technologies, so even if you use the COM Interoperable assemblies to write your code, the MapPoint 2004 Application instance will not be collected by the .NET runtime garbage collector. Before quitting your application, you must manually quit the MapPoint 2004 Application by calling the Quit method on the MapPoint.Application object: //Define MapPoint Application instance MapPoint.Application app = null; //Obtain app references either via MapPoint.ApplicationClass or //MapPoint.AxMapPointControl.ActiveMap.Application . . . //Clean up the MapPoint Application before you exit if(app != null) { app.Quit( ); app = null; } The Quit method discards the current map and unloads all other items, such as add-ins, before exiting the application. However, calling this method asks the user whether she wants to save the map before discarding it. If you don't want users to have this choice, you can set the Saved property to TRue on the application's active Map object: app.ActiveMap.Saved = true; Setting this value means that the user will not be prompted to make a decision whether to save or discard the current map.
So far, we have covered major APIs offered by MapPoint 2004 for finding places, addresses, and nearby interests, along with some basic map operations, such as placing pushpins, zooming, and panning. A discussion of MapPoint 2004 programming is not complete if we don't mention latitude and longitude , so before we move on to routing and driving directions, let's look at finding addresses for latitude and longitude in MapPoint 2004.
|