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

MapPoint 2009

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
ViaVirtualEarth
SVG Tutorials
MapPoint

Map Visitors

 Direct Media

Small business IT
Connect, the IT support specialists, are the market leader for small and medium sized businesses in the UK. Give us a call today!

printer cartridges
Don't settle for any old supplier. Get the best ink for the best price. See our great range of printer cartridges at competitive prices.

Cheap flights to Greece
Check Holiday Hypermarket for the latest cheap flights to Greece. Save your money for memorable souvenirs. See online today!

Holiday to Greece
Book a holiday to Greece today! There is something for everyone with a famous ancient history but also fantastic weather.

Property Bulgaria...
When you are contemplating a home in Bulgaria, you should look at this property….

Holiday Deals
Don't miss out on our fantastic holiday deals to a range of exotic destinations. We use over twenty top travel agents and tour operators to bring you great value holiday deals.

Cheap Turkey Holidays
The best time of year to sneak in cheap Turkey holidays is during the off-peak season. Check out the great deals available during April, May or October. For other tips on how to bag a great value holiday simply check online at ulookubook.com

Borough High Street Offices
MLS Business Centre’s can provide you with info on office space available in Borough High Street.

  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: jack.melgers(AT)thaumat.com
URL: http://www.thaumat.com
Jack Melgers is GIS Analyst at Thaumat G.T.S. in Zamudio, Spain. Thaumat provides an AVL and fleetmanagement system NaveControl/NaveReport



Google
 
MP2Kmag Internet


 Recent Discussion
-Postcode Data- Northern Ireland
-Live Maps updated in China
-Testing for point in Polygon with Javascript
-Live Search Maps Improves Internationally
-Help with Routing
-MapForums Newsletters
-Virtual Earth Based NYCT Trip Planner Surpasses 10K Daily User Milestone
-multiple distance queries
-Ask.com Migrates off of DeCarta. What’s the size of the self-hosted map market?
-Ask Maps Now Using Virtual Earth
-Importing LatLongs and postcodes from excel
-Side by Side comparison 2006 and 2009
-Mappoint failed to load error..
-"The Virtual Earth Map Control is HUGE!" Or, is it?
-Checking the vertex within the shape
-Looking for help with using Virtual Earth for broadcasts
-Hi from a broadcaster in Ireland
-Bandwidth Exceeded
-Hi... getting started
-Mappoint 2006 US version
-ESRI Shapefile Layers on a Virtual Earth Map
-Dear Forum,
-Queryshape not returning all records
-Somebody Steal Your Blog?
-Microsoft Environment Group
 Resources
Browse GIS books and periodicals
Best Car Contract Hire Lease Save
Find a MapPoint Partner or Consultant
Real Estate Columbia For Sale By Owner


Want Your Site To Appear Here?

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

• Replacement Cordless Phone Batteries from DSMiller
Improve your career with a computer degree LocalEDU.com
• Tim Cohn's Marketing Strategy Consultancy
• Buy Toner, Ink Cartridges & Drums at Marquee Office Solutions
• Looking for Dry Erase Boards? See Dry Erase Boards • The Search Starts Here Used Cars
• 5339 - We Know Bikes: Road Bikes / Triathlon Bikes / Mountain Bikes / BMX Bikes
• Buy Your Car Used Cars, Car Lease and Contract Hire