MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Need to close then open MapPoint COM Object

This is a discussion on Need to close then open MapPoint COM Object within the MapPoint 2006 Discussion forums, part of the Map Forums category; I have had some odd behavior and memory issues with MapPoint 2004 and was advised by Microsoft that I would ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006 Discussion

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

Notices


Click here to register

Reply

 

LinkBack (4) Thread Tools Display Modes
  4 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 02-16-2008
Senior Member
Green Belt
 
Join Date: Jul 2005
Posts: 105
Need to close then open MapPoint COM Object

I have had some odd behavior and memory issues with MapPoint 2004 and was advised by Microsoft that I would be best to close the COM object one in a while, versus having my program leave the same instance running for 12 hours at a clip. I see the inherent logic of this plan and am trying to stop, then restart my instance of MapPoint every 15 minutes or so.

This is the function I use to create an instance of MapPoint:

private MapPoint.Map MakeNewMap( AxMapPoint.AxMappointControl mpControl )
{
string objTemplate = Configuration.MapPointDir;
mpControl.NewMap(objTemplate);
return mpControl.ActiveMap;
}

Can anyone give me the code I need to unload this instance? When I use this function it fails:

public void RefreshMapPointComObject()
{
axMappointControl1.ActiveMap.Saved = true;
axMappointControl1.Dispose();
MakeNewMap(axMappointControl1);
}


I get COM Object seperated from its underlying connection.

How do I destroy the COM object completely then recreate it so I can start using it again?? I have made sure to remove any and all references to it.

I assume if I get the right call (CloseMap() does not work) that I can see it close in Task manager. Am I right about that? Does it take some time for this to take place?

I even tried this in an attempt to remove the MapPoint COM object:

axMappointControl1.ActiveMap.Saved = true;
axMappointControl1.CloseMap();
Trip.NAR(axMappointControl1.ActiveMap);
this.Controls.Remove(this.axMappointControl1);


but with no luck. The MapPoint.exe program is still listed in the Processes page of the Task Manager.

Can anyone tell me how to get rid of it?? I need to do this so I can then reload it.


Thanks,
Bob
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 02-18-2008
lfdmike's Avatar
Member
Yellow Belt
 
Join Date: May 2004
Posts: 39
Blog Entries: 7
Re: Need to close then open MapPoint COM Object

Have you tried this:
set object = nothing
__________________
Mike Mueller
Lannon Fire Department
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 02-19-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 1,953
Re: Need to close then open MapPoint COM Object

Hi,

This will create a new activeX control:

Code:
AxMapPoint.AxMappointControl mp;

mp = new AxMapPoint.AxMappointControl();
Controls.Add(mp);
mp.Visible = false;
mp.OpenMap(fileName);
This will remove and destroy it. The mappoint.exe is removed in task manager:

Code:
Controls.Remove(mp);
mp.Dispose();
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-21-2008
Junior Member
White Belt
 
Join Date: Mar 2008
Posts: 1
Re: Need to close then open MapPoint COM Object

user this to release any COM object from the process.

System.Runtime.InteropServices.Marshal.ReleaseComObject(refMapObject);
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/need-close-then-open-mappoint-com-object-7151.html

Posted By For Type Date
Using MapPoint In Delphi - MapPoint Articles - MP2K Magazine This thread Refback 02-24-2008 01:26 PM
Finding the Starting Point of a Route - MapPoint Articles - MP2K Magazine This thread Refback 02-20-2008 06:46 PM
Pushpin Tool Add-in - MP2K Magazine This thread Refback 02-19-2008 02:18 PM
MapPoint Download - MP2K Magazine This thread Refback 02-18-2008 06:07 PM

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
MapPoint 2006 ActiveX with Form.Close jasanite MapPoint 2006 Discussion 6 08-09-2007 02:29 PM
How to close MapPoint applications correctly? doMapPoint MapPoint 2006 Discussion 12 05-30-2007 12:02 PM
MapPoint OCX SLOW on close. Gianmaria MapPoint 2006 Discussion 3 01-31-2007 12:32 PM
How to properly close mappoint control Anonymous MapPoint 2006 Discussion 1 03-03-2005 08:05 AM
Mappoint has encountered a problem and needs to close Anonymous MapPoint 2006 Discussion 4 05-05-2004 03:40 PM


All times are GMT -5. The time now is 06:50 AM.


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

Exeter Flights
Visit Holiday Hypermarket online to find all the essential information about Exeter Airport and Exeter flights. Booking is quick, easy and cheap with Holiday Hypermarket.

Best Travel Agent
Book your Travel with the UK's best Travel Agent - as named at the Guardian Unlimited Travel awards.

Portugal Holiday
For such a small country, you have many options from which to choose. A Portugal Holiday can include fantastic beaches and stunning scenery. Check out our great deals.

Holidays to Cuba
For the best offers on holidays to Cuba, visit The Holiday Place today. Find a deal to suit you and your budget online!

Cheap Egypt Holidays
Pick up a bargain cheap Egypt holiday online when you visit ulookubook.com. Just check out our tips to make sure you book at the right time to get a great holiday for a great price. Finding cheap Egypt holidays can be simple when you know how.

Compare Holidays
Compare holidays online where you can see all the amazing possibilities at Travel.co.uk

Cheap Holidays to Lanzarote
Visit the Canary Islands, even if you're cash strapped! View cheap holidays to Lanzarote at On The Beach!


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