spacer1
spacer2 1_1 1_2
2_1
 Subscribe
 The MP2K Update!
 
 
 
 Magazine
Front Cover
What's New
Articles
News
Sample Data
Gallery
Advertise
About
 Features
MapPoint 2013
Press Releases
MapPoint Forums
Companies
Link to MP2Kmag
Wish List
MapPoint Trial
Authors
 Earlier Content
Past News Items
Past What's New Announcements
 Sponsors
 Order

MapPoint 2013

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
SVG Tutorials
MapPoint

Map Visitors

  ARTICLES  


Using MapPoint In Delphi

Jack Melgers explains how developers can go about using MapPoint within Delphi and provides several code snippets

From the many postings, it's now commonly known that you can not use the MapPoint 2002 ActiveX-control in Delphi, youŽll end up with the message: 'No such interface supported'. Nevertheless, there are other ways for using MapPoint 2002 in Delphi and below IŽll give some comments.

1) Importing MapPoint_TLB

Start by importing the Type Library (TLB) in Delphi. Choose 'Import Type Library', select 'Microsoft MapPoint 9.0 Object Library', tick 'Generate Component Wrapper' and then click 'Install'. This will compile and build a Delphi package and as a result three MapPoint components will appear on the ActiveX-tab of the Component Palette: TApplication, TMap and TMapPointUtilities.

2) Using MapPoint TApplication as a component on the form

Create a new Delphi application and drop the MapPoint component TApplication on the Delphi-form. Make it visible in the Activate-event of the form. This will execute MapPoint in a separate window:

Doing so, you can access the MapPoint Object Model and start developing. For instance, get the ActiveMap and zoom to a location:

3) Creating a MapPoint.Map in an OleContainer

If you donŽt want MapPoint to execute as a separate application you can use TOleContainer in Delphi. Create a new Delphi application and drop an OleContainer component on the form, add MapPoint_TLB in the 'uses' section and add the following code to Activate-event of the form:

('MapPoint.Map.EU.9' is the OleClassName for the European edition of Mappoint and 'FMap' is a global variable of type _Map).

Note in general: If you can not properly access the MapPoint Application in Delphi, the cause maybe a conflict with the Delphi Application. Therefore, open the 'Mappoint_TLB.pas' and find the declaration of CoClasses and rename 'Application = _Application' to, for instance, 'Application1 = _Application'.

4) Accessing MapPoint Add-ins

If you have developed an Add-in (the MapPoint-Help gives a step-to-step explanation how to create an Add-in with Visual Basic) you can access it from Delphi.

Create a new Delphi application and drop a MapPoint TApplication on the form.

Declare the global variables:
- FAddIns : AddIns;
- FMyAddIn : OleVariant;

Connect to the add-in in the Activate-event of the form:

And disconnect in the Close-event of the form:

Now in the Delphi-application you can access methods in the Add-in. For instance:

You can also pass parameters to the Add-in. See the following example for passing two parameters of type integer:

Discuss this story in the forum.

Author: Jack Melgers
Email: jackmelgers@yahoo.es
URL: http://es.linkedin.com/in/jackmelgers
Jack Melgers is freelance consultant in Spain and he is involved with GIS development projects and training services.



Google
 
MP2Kmag Internet


 Recent Discussion
-numeca fine
-AutoColor
-SolidThinking Inspire v2016.1.5559 x64-BEAN (17/8)
-Auto FX PhotoGraphic Edges Ultimate Bundle Gen2 v9.6.0 (17/8)
-Mentor Graphics FloEFD 14.2-SSQ (17/8)
-Dlubal RFEM 5.06 (x64) Multilanguage (17/8)
-Bluebeam Revu eXtreme 2018.1 v18.x Multilingual (17/8)
-Autodesk Maya 2018.4 (17/8)
-Adobe Bridge CC 2018 (v8.1) x86-x64 Multilingual Update 2 (17/8)
-Simufact.Welding 4.0.1 (17/8)
-ANSYS Discovery Enterprise 19.1.1 (17/8)
-Aurora SPARK3D v2018
-ANSYS Electromagnetics Suite 17.1 (17/8)
-Solidthinking Inspire v2018.3.0.10526 Multilingual (x64) (17/8)
-Adobe Acrobat Pro DC 2018.011.20058 Multilingual (17/8)
-ANSYS Electromagnetics Suite 17.0 (x64) (17/8)
-GibbsCAM 12.0.29.0 (x64) Multilingual (17/8)
-Autodesk Autocad Mechanical 2019.1 by m0nkrus (17/8)
-Adobe Bridge CC 2018 v8.1 (x86/x64) Update 2 Multilingual (17/8)
-Autodesk AutoCAD Electrical 2019.1 (17/8)
-DS V5R22 CATIA-DELMIA-ENOVIA last hotfixes for all SP (17/8)
-VMware Fusion Pro 10.1.3 Build 9472307 (17/8)
-MAGIX Fotostory easy 2.0.0.35 Germany + English (17/8)
-Ds Simulia Abaqus v6.14-4 (17/8)
-Paragon Drive Copy 15 Professional 10.1.25.779 (x86/x64) (17/8)
 Resources
Browse GIS books and periodicals
Find a MapPoint Partner or Consultant
Real Estate Columbia MO Homes for Sale


Want Your Site To Appear Here?

   © 1999-2012 MP2K. Questions and comments to: website@mp2kmag.com
  Microsoft and MapPoint 2002/2004/2006/2009/2010/2011/2013 are either trademarks or registered trademarks of Microsoft.