MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint crashs after closing the application

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


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-09-2006
Junior Member
Yellow Belt
 
Join Date: Mar 2006
Posts: 13
MapPoint crashs after closing the application

Hello,

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 03-09-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

Nobody can help if you dont tell the exact error meage, and the offending line of code !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 03-10-2006
Junior Member
Yellow Belt
 
Join Date: Mar 2006
Posts: 13
I use this code when my add-in is close:

Quote:

public void OnDisconnection(Extensibility.ext_DisconnectMode disconnectMode, ref System.Array custom)
{
if(app != null)
{
app.Quit( );
app = null;
}
}
"app" is the mappoint process

Quote:

public class Test
{
private MapPoint.Application app;

//constructor
public Test(object application)
{
app = application as MapPoint.Application;

}
maybe my method is incorrect ?

I want to know the general advice to make a correct add-in, fo a perfect exit of the application
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 03-14-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2006
Junior Member
Yellow Belt
 
Join Date: Dec 2005
Posts: 16
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 04-14-2006
Junior Member
Yellow Belt
 
Join Date: Mar 2006
Posts: 13
up, my probem is not fixed, help please
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 04-15-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 04-17-2006
Junior Member
Yellow Belt
 
Join Date: Dec 2005
Posts: 16
...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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 04-18-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 04-18-2006
Junior Member
Yellow Belt
 
Join Date: Dec 2005
Posts: 16
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
application, closing, crashs, mappoint


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 12:29 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54