Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on Integrating MapPoint control into a VC++ application within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; One more try, could somebody help: I want to use MapPoint Control in my VC++ FormView based application. In the ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Integrating MapPoint control into a VC++ application I want to use MapPoint Control in my VC++ FormView based application. In the CFormView object there is the following code void CMapPointTest1View::OnInitialUpdate() { .................. VARIANT var; var.vt = VT_INT; var.intVal = 1; CMap1 map = m_MapPoint.NewMap(var); } m_MapPoint is the CMappointCtrl object to which I connected the MapPoint control element (CMappointCtrl object). A map appears. But once I click in it, MapPoint collapses. There must be a solution. Thanks! Jörg |
| |||
|
Hi, I've found the following code in this forum: I hope it gives some help Code:
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();
|
| |||
|
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 |
| |||
| Re: Integrating MapPoint control into a VC++ application
Hi guys, I've used this style of importing Mappoint, but when I close my app I get this: First-chance exception in MapPrac.exe (KERNEL32.DLL): 0x800706BE: (no name). And I've just used this code: Code: void CMapPracDlg::OnButtonStart()
{
CMap1 map;
map = m_Mappoint.GetActiveMap();
CLocation loc;
loc = map.GetLocation( 50.90695, 7.47828, 1 );
CPushpin pushpin;
pushpin = map.AddPushpin( loc.GetLocation(), "ID: Target" );
pushpin.SetBalloonState(1);
loc.GoTo();
m_Mappoint.ShowWindow( 1 );
}
I hope somebody can explain this. Does somebody has experience with another way of importing Mappoint in VC++? e.g. importing the mappoint library? How can I show the map? Normally I've done this by importing ActiveX and VC++ autamatically generates a MapControl I can drag 'n drop where I want on my GUI, to display the map. With importing library I don't know how to do that. I've read the articles how to do that, but not how to show the map. |
| |||
| Re: Integrating MapPoint control into a VC++ application
Hi, Is this the object model that you use or do you have put the activeX control on your form ?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Integrating MapPoint control into a VC++ application
Thank you for your reply Wilfried, Well it's a bit fuzzy what ActiveX or COM is. But what I know is that ActiveX IS COM, the only difference is that ActiveX has wrapped a COM object so that it can be easely used by VB or VC++, especially VB (ActiveX was developed for VB, I've read once), those guys are spoiled to much But I guess sometimes ActiveX works well for VB but not for VC++. I've imported Mappoint as an ActiveX, and it didn't work correctly, I had to add some code's I've copied from a post of someone here on this forum (I don't remember which one it is). That was a workaround, but I don't know if it was correct, I had no choice. Maybe that's why MS has no documents on how to use Mappoint with VC++. Another way to import Mappoint, is to import it's library .tlb into VC++. I haven't tried this way yet, but maybe this way is a better way. But does somebody imported Mappoint as an ActiveX without First Exception for terminating Mappoint? Thank you. |
| |||
| Re: Integrating MapPoint control into a VC++ application
Hi, Ok, I think this article explain some use with the type library (what I meant with the object model), as whell the activex control: Using the OCX from VC++
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| application, control, integrating, mappoint |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| integrating Mappoint into my home grown application | sam_ahn612 | MapPoint 2006/2009 Discussion | 1 | 03-14-2005 10:34 AM |
| Integrating MapPoint map into VB.Net App | Anonymous | MapPoint 2006/2009 Discussion | 1 | 07-22-2003 01:49 PM |
| Where to get MapPoint Control for Installing Application | Anonymous | MapPoint 2006/2009 Discussion | 1 | 01-11-2003 09:25 PM |
| Mappoint control in an Office Application using VBA | ToddRCS | MapPoint 2006/2009 Discussion | 1 | 11-19-2002 04:00 PM |
| Mappoint 2002 - can a control not an application .... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 08-14-2001 05:58 AM |
Lanzarote Holiday
Enjoy a Lanzarote holiday when you check out the offers on UlookUbook and save cash!