Community of VE/MapPoint Users and Developers
This is a discussion on MapPoint Automation with C/C++ - Part 1 within the MP2K Magazine Articles forums, part of the Map Forums category; MapPoint Automation with C/C++ - Part 1 This is the first of three articles by Sergey Kostrov on automating MapPoint ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| MapPoint Automation with C/C++ - Part 1 This is the first of three articles by Sergey Kostrov on automating MapPoint Automation with C/C++ starting with a simple C/C++ application. Read the full article here -- http://www.mp2kmag.com/a122--c-c++.a....mappoint.html To post a comment or question click "Post Reply" |
| |||
| Great thanks and when it part #2 going to be ready
Thanks for the code sample. Why Microsoft does not do a C++ or MFC example baffles me. ! It would be great to get a code sample that allows true integration in my porgram. i.e. a map display within my UI. Hans W |
| |||
| It would be great to get a code sample that allows true inte
Hans W wrote some time ago: "...It would be great to get a code sample that allows true integration in my porgram. i.e. a map display within my UI..." You can integrate MapPoint functionality in two different ways and it's not difficult: - with ActiveX MapPoint control ( it can be used with VB, pure C++, MFC etc ); - or, if your application is using only MFC, and you want to use MapPoint automation, try to use CHtmlEditView class. Best regards, Sergey |
| |||
| MapPoint Automation with C/C++ - Part 1
Thanks for the article. It is on track for what I wanted to do. But the problem I am having is that I can't get the code sample to run correctly. All works fine until the program exits (after the ConUninitialize()). At this time I get a trap in _Release() accessing m_pInterface. m_pInterface has a non-NULL value but appears to be invalid. I believe it may be due to not having a myMapPtr->Release(), as well as other object releases. I have tied this, but I have not found the right combination (if indeed this is the problem). Any insights as to what is happening or how to diagnose this problem? |
| |||
| My response is related with COM exception ( 0xC0000005 )...
My response is related with COM exception ( 0xC0000005 ) at the end of execution MapPoint test application described in article ( Part 1 )... Unhandled exception 0xC0000005 "Access Violation" happens because: - all your COM objects were released after g_pMapPoint->Quit() was executed; - but, pointers to COM objects you worked with are still NOT NULL. You can fix it in a very simple way: ... myMapPtr->Saved = true; try { if( g_pMapPoint != NULL ) { g_pMapPoint->Quit(); } } catch( ... ){} resultsPtr = NULL; locAddressPtr = NULL; pinAddressPtr = NULL; myMapPtr = NULL; g_pMapPoint = NULL; CoUninitialize(); } I tested it and everything is fine now. Best regards, Sergey |
| |||
| Don't forget to add this statement: using namespace MapPoint
Don't forget to add this statement: using namespace MapPoint... So, it should look like: #include "ComInterfaces.h" using namespace MapPoint; // <<-- MapPoint::_ApplicationPtr g_pMapPoint = NULL; void main(void) { CoInitialize(NULL); ... } Best regards, Sergey |
| |||
| Where can i find help?
I receive this error while compiling the demo: error C2664: 'FindAddressResults' : cannot convert parameter 6 from 'enum MapPoint::GeoCountry' to 'const class _variant_t &' Reason: cannot convert from 'enum MapPoint::GeoCountry' to 'const class _variant_t' No constructor could take the source type, or constructor overload resolution was ambiguous I have european version so i load MPEU82.tlb instead of MPNA82.tlb, but i think this is not important. Where can i find help about the methods i can call with mapPoint? I mean, how can i know how to use the FindAddressResults method or anyone else? Is there any documentation about using this API? Thanks a lot |
| |||
| I forgot to say...
I want to make an application that gets a list of nearby places in text mode (given a long/lat position) and also gets an image map of that point. I know it must be very simple but i'm new on this and i don't know where to begin.. Thanks again! |
| |||
| And...
I solved the problem mentioned above Quote:
FindResultsPtr resultsPtr = myMapPtr->FindAddressResults ( “400 Coronado Dr”, “Denton”, "", “TX”, “76209” ); So now it compiles, but when i hit the "Build MapPointApp.exe" option in Microsoft Visual c++ 6, it gives me lots of errors Code: Linking... MapPointApp.obj : error LNK2001: unresolved external symbol "public: long __thiscall MapPoint::_Application::Quit(void)" (?Quit@_Application@MapPoint@@QAEJXZ) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::_Map::PutSaved(short)" (?PutSaved@_Map@MapPoint@@QAEXF@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: long __thiscall MapPoint::Pushpin::Delete(void)" (?Delete@Pushpin@MapPoint@@QAEJXZ) MapPointApp.obj : error LNK2001: unresolved external symbol "public: long __thiscall MapPoint::_Map::SaveAs(class _bstr_t,enum MapPoint::GeoSaveFormat,short)" (?SaveAs@_Map@MapPoint@@QAEJV_bstr_t@@W4GeoSaveFormat@2@F@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: long __thiscall MapPoint::_Map::ZoomIn(void)" (?ZoomIn@_Map@MapPoint@@QAEJXZ) MapPointApp.obj : error LNK2001: unresolved external symbol "public: long __thiscall MapPoint::Location::GoTo(void)" (?GoTo@Location@MapPoint@@QAEJXZ) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::Pushpin::PutHighlight(short)" (?PutHighlight@Pushpin@MapPoint@@QAEXF@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::Pushpin::PutBalloonState(enum MapPoint::GeoBalloonState)" (?PutBalloonState@Pushpin@MapPoint@@QAEXW4GeoBalloonState@2@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::Pushpin::PutSymbol(short)" (?PutSymbol@Pushpin@MapPoint@@QAEXF@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: class _com_ptr_t<class _com_IIID<struct MapPoint::Pushpin,&struct __s_GUID _GUID_34b0f619_37e1_4c76_a6da_69bf75a5d3de> > __thiscall MapPoint::_Map::AddPushpin(struct MapPoint::Loca tion *,class _bstr_t)" (?AddPushpin@_Map@MapPoint@@QAE?AV?$_com_ptr_t@V?$_com_IIID@UPushpin@MapPoint@@$1?_GUID_34b0f619_37e1_4c76_a6da_69bf75a5d3de@@3U__s_GUID@@A@@@@PAULocation@2@V_bstr_t@@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: class _com_ptr_t<class _com_IIID<struct IDispatch,&struct __s_GUID _GUID_00020400_0000_0000_c000_000000000046> > __thiscall MapPoint::FindResults::GetItem(struct tagVARIANT *)" (?G etItem@FindResults@MapPoint@@QAE?AV?$_com_ptr_t@V?$_com_IIID@UIDispatch@@$1?_GUID_00020400_0000_0000_c000_000000000046@@3U__s_GUID@@A@@@@PAUtagVARIANT@@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: class _com_ptr_t<class _com_IIID<struct MapPoint::FindResults,&struct __s_GUID _GUID_188084cf_db96_482b_97a6_2571df9bef81> > __thiscall MapPoint::_Map::FindAddressResults(class _bs tr_t,class _bstr_t,class _bstr_t,class _bstr_t,class _bstr_t,class _variant_t const &)" (?FindAddressResults@_Map@MapPoint@@QAE?AV?$_com_ptr_t@V?$_com_IIID@UFindResults@MapPoint@@$1?_GUID_188084cf_db96_482b_97a6_2571df9bef81@@3U__s_GUID@@A@@@@V_bstr _t@@0000ABV_variant_t@@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: class _com_ptr_t<class _com_IIID<struct MapPoint::_Map,&struct __s_GUID _GUID_90b167c0_923d_4b65_aee2_66938491c916> > __thiscall MapPoint::_Application::GetActiveMap(void)" (?GetAc tiveMap@_Application@MapPoint@@QAE?AV?$_com_ptr_t@V?$_com_IIID@U_Map@MapPoint@@$1?_GUID_90b167c0_923d_4b65_aee2_66938491c916@@3U__s_GUID@@A@@@@XZ) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::_Application::PutUnits(enum MapPoint::GeoUnits)" (?PutUnits@_Application@MapPoint@@QAEXW4GeoUnits@2@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::_Application::PutCaption(class _bstr_t)" (?PutCaption@_Application@MapPoint@@QAEXV_bstr_t@@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::_Application::PutWindowState(enum MapPoint::GeoWindowState)" (?PutWindowState@_Application@MapPoint@@QAEXW4GeoWindowState@2@@Z) MapPointApp.obj : error LNK2001: unresolved external symbol "public: void __thiscall MapPoint::_Application::PutVisible(short)" (?PutVisible@_Application@MapPoint@@QAEXF@Z) Debug/MapPointApp.exe : fatal error LNK1120: 17 unresolved externals Error executing link.exe. MapPointApp.exe - 18 error(s), 0 warning(s) |
| |||
| Compiling error in mpna82.tli
Hi, Sergey, I tried to integrate your example to my CDialog derived class, but always get compiling error like this: ...\source\debug\mpna82.tli(16) : error C2653: '_Application' : is not a class or namespace name Any idea what's going on with my application? I alsoe tried to insert a MapPointControl OCX object into my class, but it crashed when I tried to call the OpenMap() method. Appreciate your help. Frank |
![]() |
| Tags |
| automation, c or c, mappoint, part |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using Python to control MapPoint, Part 1 | Eric Frost | MP2K Magazine Articles | 0 | 03-26-2006 11:29 PM |
| MapPoint Automation with C/C++ - Part 2 | Eric Frost | MP2K Magazine Articles | 1 | 09-20-2005 11:00 AM |
| Automation -- Unable to kill mappoint.exe | Anonymous | MapPoint 2006/2009 Discussion | 0 | 02-03-2004 11:12 PM |
| Error in VBA automation of MapPoint when PO BOX is found | JPeters | MapPoint 2006/2009 Discussion | 2 | 01-09-2003 10:40 AM |
| I am using Mappoint with Visual C++ via automation.... | Anonymous | MapPoint 2006/2009 Discussion | 2 | 07-08-2002 02:07 AM |