Closing MapPoint

pepumarius
05-02-2007, 09:58 AM
Hy,

Has anybody found that closing the MapPoint ActiveX control is rather "dangerous"? I have found that on one system the application closed normaly (when closing the main form that contains the ActiveX control) but on other systems, the application hangs and refuses to close. I have to use the Task Manager to kill the process :-( . I mention that i use MapPoint 2006.

What can i do?

Here is the code i use to open (start) the ActiveX control and the code to close it:

var Map1: TMap;

procedure StartMP;
begin
with Form1.OLEContainer do begin
DestroyObject;
CreateObject('MapPoint.Map.EU.13',FALSE);
DoVerb(PrimaryVerb);
OleObjectInterface.GetUserClassID(vGuid);
FMap := IDispatch(OleObject) as _Map;
with Map1 do
ConnectTo(FMap);
end;
end;
//--------------------------
procedure CloseMP;
begin
Form1.Close;
end;

Quin
05-03-2007, 03:49 AM
I had this problem of getting MapPoint.exe to close when the VB.Net app containing the ActiveX control was closed.
The solution I found was to ensure that the CloseMap method of the ActiveX control was called in the form's Closing event. Then all went well!

pepumarius
05-04-2007, 08:17 AM
Hy... But i don't have a CloseMap method... in the ActiveX control that is installed on Delphi there is no such method.

Quin
05-04-2007, 09:35 AM
Hmmm. I'm using .Net and the control there certainly has CloseMap.
All I can offer is a link to the Microsoft MSDN Library where it is described:
CloseMap method (http://msdn2.microsoft.com/en-us/library/aa562355.aspx)
My .Net projects reference the MapPoint Control 13.0 (MapPoint 2006) via:
AxInterop.MapPoint.dll
and
Interop.MapPoint.dll

 
Web mp2kmag.com
mapforums.com