View Single Post

  #6 (permalink)  
Old 06-13-2006
geouser geouser is offline
Junior Member
Yellow Belt
 
Join Date: Jun 2006
Posts: 13
The following is the solution:

1. Add the follwing function into the CMappointCtrl object:

COleControlSite* CMappointCtrl::GetCtrlSite()
{
return m_pCtrlSite;
} which returns the control site.

2. Add #include "OccEx.h" into your FormView or Dialog object or where you want to display the map.

3. In the FormView or Dialog add the following to OnInitialUpdate():

void CMapPointTest1View::OnInitialUpdate()
{
............................

SetCapture();
// Open the MAP
VARIANT var;
var.vt = VT_INT;
var.intVal = 1; //geoMapUSA
CMap1 map = m_MapPointCtrl.NewMap(var);

// This fixes the problem
m_pCtrlCont->OnUIDeactivate(m_MapPointCtrl.GetCtrlSite());
m_pCtrlCont->OnUIActivate(NULL);
SetFocus();

ReleaseCapture();
}

m_pCtrlCont then returns the control container.
It is stable (as far as I see now).

Thanks to everyone
Reply With Quote