开发者

MapPoint not shutting down properly?

I'm trying to use MapPoint's COM API from VB6, running it in application 开发者_运维百科mode, but when I close things down, MapPoint still hangs around! How do I get it to stop cleanly? Yes I've tried calling the Application object's Quit method.


Despite VB6's faults, your life is actually easier with VB6 as most of the samples are written in it. Also there's a garbage collector.

First make sure all references to MapPoint objects are set to 'nothing' (excluding the Application object). This will let the garbage collector do its job. As well as good memory management, when you come to close MapPoint, the garbage collector will know that all these other objects can be freed. MapPoint will not close until all external references are cleared. Also is the dialog box asking if you want to save appearing? This can be removed by using the Map.Save() method to save the map, or by setting the Map's Saved property to true. This property actually controls the dialog box. You make some changes and it is reset; you save the map, it is set. The dialog box appears if it is set to false.

Then, finally, call the Application's Quit method, and then for good measure clear the application reference.

eg.

myMapPointApp.ActiveMap.Saved = true
call myMapPointApp.Quit
set myMapPointApp = Nothing
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜