Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

MapPoint crashs after closing the application

This is a discussion on MapPoint crashs after closing the application within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have this same problem with Mappoint sometimes crashing when exiting. I have developed an applicaiton that uses VB .NET ...

  1. #11
    tvwatne is offline Junior Member White Belt
    Join Date
    Jun 2006
    Posts
    1

    Mapoint Crashs on Exit

    I have this same problem with Mappoint sometimes crashing when exiting. I have developed an applicaiton that uses VB .NET 2002 and the active x component of Mappoint to display a map.

    I use the ActiveMap.Saved = true, AcitveMap.Application.quit and .closemap functions but I still get an error when the application closes.

    I don't know of any mean to post a message to mappoint through the acitve x component to close out Mappoint.exe.

    Is there other options with an active x component to get this to quit happening?

    Terry

  2. #12
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    You dont need to AcitveMap.Application.quit if you close your application using the AcitveX component. That is probably the reason of your error.

  3. #13
    Aaaron16 is offline Junior Member White Belt
    Join Date
    Dec 2006
    Posts
    2

    Re: MapPoint crashs after closing the application

    I've had this problem for a while and finally figured it out...

    Most calls to the MapPoint object return a COM object that must be cleaned up properly. In my case, I wasn't properly handling them as they were created. Here's the code that was causing MapPoint to crash when exited:

    MapPoint.Application g_oApp = (MapPoint.Application) applicationObject;

    object pp = g_oApp.ActiveMap.ShowFindDialog("101 The City Dr S, Orange, CA", MapPoint.GeoFindState.geoFindAddress, 0, false);

    if (pp != null)
    {
    if (pp is MapPoint.Pushpin)
    {
    g_oApp.ActiveMap.Route.Add((MapPoint.Pushpin) pp, loc.fac);
    }
    ReleaseObject(pp);
    }

    The problem is that the call to g_oApp.ActiveMap.ShowFindDialog(...) creates a Map and push-pin object (assuming an address was selected in the Find dialog box).

    Also, g_oApp.ActiveMap.Route.Add(...) creates another Map object as well as Route and Waypoint objects. In order to clean everything up properly, the objects must be maintained as follows:

    // Add the waypoint to the current route
    MapPoint.Application g_oApp = (MapPoint.Application) applicationObject;
    MapPoint.Map map = g_oApp.ActiveMap;
    MapPoint.Route route = map.ActiveRoute;
    route.Clear();
    // Clear out old route if any

    // Display the find dialog
    object pp = map.ShowFindDialog("101 The City Dr S, Orange, CA, 92868", MapPoint.GeoFindState.geoFindAddress, 0, false);


    // Is the location a valid push-pin?
    if (pp != null)
    {
    if (pp is MapPoint.Pushpin)
    {
    MapPoint.Waypoints wp = route.Waypoints;
    MapPoint.Waypoint p = wp.Add((MapPoint.Pushpin) pp, loc.fac);
    ReleaseObject(p);
    ReleaseObject(wp);
    }
    ReleaseObject(pp);
    }

    ReleaseObject(route);
    ReleaseObject(map);

    Hope this helps.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Disabling closing of MapPoint?
    By MD2000 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-09-2005, 05:57 PM
  2. Closing: MapPoint process stilll running
    By MD2000 in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 04-29-2005, 09:58 AM
  3. Closing Without Saving A territory map
    By Yazzy in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-27-2005, 03:26 PM
  4. Closing without saving
    By Mudrover in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-30-2005, 08:49 AM
  5. I am trying to use the Mappoint in my application ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 12-03-2001, 10:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25