Community of VE/MapPoint Users and Developers
This is a discussion on MapPoint crashs after closing the application within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello, I developp an add-in for Mappoint, and every times I close MapPoint an error message comes I want to ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| MapPoint crashs after closing the application I developp an add-in for Mappoint, and every times I close MapPoint an error message comes I want to know tips for developping add-in to avoid theses crashs after closing MapPoint ? maybe I must do something in my source code ( method "OnDisconnection" ) to have a clean exit for MapPoint ? I have the book "Programming MaPpoint in .Net" by Chandu Thota but it says nothing about clean exit when we developp add-in for Mappoint, help me to fix this problem please thanks |
| |||
|
Hi, Nobody can help if you dont tell the exact error meage, and the offending line of code !
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
I use this code when my add-in is close: Quote:
Quote:
I want to know the general advice to make a correct add-in, fo a perfect exit of the application |
| |||
|
Hi, MP.Quit is the correct method to terminate the application object. But I never wrote an add-on, so maybe situation is different. Hopefully someone else drops in with the right knowledge.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hi Elbarto, I've got the same problem. Writing in VB .net the relevant code is: Public Class connect Dim applicationObject As Object Dim addInInstance As Object Dim FormAddIn As MyAddinProject.Form1 Protected Friend Shared MPApp As MapPoint.Application Private Sub ReleaseObject(ByVal MPApp As Object) Try Try 'cause it's not sure, if the user already has close it FormAddIn.Close() Catch ex As Exception End Try System.Runtime.InteropServices.Marshal.ReleaseComO bject(MPApp) Catch Finally MPApp = Nothing End Try End Sub Public Sub OnDisconnection(ByVal RemoveMode As Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnDisconnection On Error Resume Next If RemoveMode <> Extensibility.ext_DisconnectMode.ext_dm_HostShutdo wn Then _ Call OnBeginShutdown(custom) MPApp.RemoveCommands("my addin") ReleaseObject(MPApp) End Sub Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection applicationObject = application addInInstance = addInInst MPApp = CType(application, MapPoint.Application) ' Add an item to the Tools menu in MapPoint. MPApp.AddCommand("my addin", "ShowAddInForm", Me) End Sub Public Sub ShowAddInForm() FormAddIn = New MyAddinProject.Form1 FormAddIn.Show() End sub End Class Public Class Form1 objApp = GetObject(, "MapPoint.Application") objMap = objApp.ActiveMap Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Call CleanMap() objMap = Nothing objApp = Nothing End Sub End Class ...and the error message is something like: "MapPoint has detected an error and has to shut down...", - I'm using the German edition 2002 with the European map. I don't know what's the problem... Would be great if someone can explain how to correctly clean up the addin before MapPoint closes, - because the error-message doesn't appear when VS .net closes my addin. thank the one martin |
| |||
|
Hi, If it is in C# and you strip your project to a few lines of code just to demonstrate the error you may private email it to me. I have some spare time tomorrow so I can "try" to check it out. However I did not do add-ins, so I have no experiance with it. Anyway I can try
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
...found a descriptions for VB and C# on http://support.microsoft.com/?scid=k...530&sid=global http://support.microsoft.com/?scid=k...530&sid=global The point is: "...Both the OnStartupComplete and OnBeginShutdown methods are called when the host application has left or is entering a state in which user interaction should be avoided because the application is busy loading or unloading itself from memory." I am not that fit in system internal and threads etc. and still hadn't time to try it out but I'm sure that's it. The main problem is not to clean up the right way but at the right moment. That explains why sometimes the error message appeard and sometimes not... greetings an Merry Easter martin |
| |||
|
Hi Martin, Thanks for feedback. I did not study the articles (sorry) but the right time could be when the mappoint application enters the message pump. This can be done by posting a WM_QUIT to the mappoint application using the windows API PostMessage function.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
|
Hallo Wilfried, you don't have to be sorry for don't doing things that are not really your business! So this here should be more a short hint for those who are interested in as an answer... The main cleaning up doesn't belong to the OnDisconnection method of the IDTExtensibility2 interface but to the OnBeginShutDown method. That is at least the point. If done everything what belongs to the addin is finished when the MapPoint application is starting its unloading. No further problems. Thank you for care thomas martin |
![]() |
| Tags |
| application, closing, crashs, mappoint |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Disabling closing of MapPoint? | MD2000 | MapPoint 2006/2009 Discussion | 1 | 05-09-2005 05:57 PM |
| Closing: MapPoint process stilll running | MD2000 | MapPoint 2006/2009 Discussion | 4 | 04-29-2005 09:58 AM |
| Closing Without Saving A territory map | Yazzy | MapPoint 2006/2009 Discussion | 3 | 04-27-2005 03:26 PM |
| Closing without saving | Mudrover | MapPoint 2006/2009 Discussion | 1 | 01-30-2005 08:49 AM |
| I am trying to use the Mappoint in my application .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 12-03-2001 10:53 PM |