Map Point ActiveX in MFC View (MDI application)
Did somebody knows how to embed a MapPointCtrl into FormView in MFC.
I tried to use
BOOL CRaw_com1Dlg::PreTranslateMessage(MSG* pMsg)
{
// for modeless processing (or modal)
ASSERT(m_hWnd != NULL);
ASSERT(::IsWindow(m_hWnd));
if (((CLEDOccManager*)afxOccManager)->IsDialogMessageHACK(this, pMsg))
return TRUE;
// filter both messages to dialog and from children
return PreTranslateInput(pMsg);
}
from dialog based application, but when I click on the Map the application got a Stack overflow.
"The Fix" to "Map Point ActiveX in MFC View (
Hi everyone,
I tried the below solution (please scroll down) by adding the code into my form view CTryMP1View::OnInitialUpdate(), and I got this compiler error complaining about "m_pCtrlCont":
error C2027: use of undefined type 'COleControlContainer'
c:\vs\vc98\mfc\include\afxwin.h(1872) : see declaration of 'COleControlContainer'
Could anyone tell me how the poster got the "m_pCtrlCont" pointer???
Could you please reply to kchan@KenwoodUSA.com ?
Thanks in advance!
===== ORIGINAL MESSAGE posted by "ImplicitSoftware" =======
OK, this is what worked for me.
In your CMapPointCtrl class add this public function:
inline COleControlSite* GetCtrlSite() {return m_pCtrlSite;}
Remember that when you re-init your activeX control this file will get written over.
And then when you initiliaze the map do this:
SetCapture();
// Open the MAP
VARIANT var;
var.vt = VT_INT;
var.intVal = 1; //geoMapUSA
CMap1 map = m_MapPoint.NewMap(var);
// This fixes the problem
m_pCtrlCont->OnUIDeactivate(m_MapPoint.GetCtrlSite());
m_pCtrlCont->OnUIActivate(NULL);
SetFocus();
ReleaseCapture();
ImplicitSoftware - I am grateful to you for your help!
That is so wonderful! I had no optmizm for a decision of that problem. I was so busy by another topics on my project.