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 2009
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 2009

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
ViaVirtualEarth
SVG Tutorials
MapPoint

Map Visitors

 Direct Media

Travel Insurance Compare over 450 travel insurance policies (inc. annual multi-trip, single trip & winter sports)

Cheap flights to Italy
Italy is overflowing with things to do, things to see and things to eat. Why not book cheap flights to Italy online right now?

Flights to India
Don't miss out on the great value flights to India available online at dealchecker.co.uk. India is home to the descendants of one of the world's oldest civilisations, the Indus Valley civilisation.

Cyprus
Before visiting Cyprus, make sure you are well informed to make the most of your holiday. Online at ulookubook.com you check out our useful travel guides. Find out all about the Cyprus nightlife, shopping, eating and customs.

  ARTICLES  


Home Locator Sample Application

John Washenberger writes, "In the spirit of the MDB 'Circus' Contest, the application I have submitted could be considered a 'three-ring extravaganza'."

The application is a simple Home Locator. Download it here. It contains a single table of properties (i.e., homes). Each property includes address information and a sale price. When the application is opened, the startup form displays the properties sorted by price in descending order. A simply query interface is included on the form to allow the user to display properties within a price range. A checkbox is included for each displayed property to allow the user to select properties that can subsequently be displayed on a map that can be output to a report.

In this article, I will demonstrate some interesting approaches to using MapPoint within an Access application. I will not go into any detail on the Access specific code itself. Instead I’ll focus on using MapPoint from within the Access application offering a couple alternatives to conventional methods.

For example, the application does not use the MapPoint OCX control. It uses an instance of MapPoint that is “pulled” into an Access form. An advantage of doing this is that all the MapPoint functionality is available which is not true when using the OCX. For example, the Print Dialog is not accessible to an application using the OCX. Instead the developer must write code using the PrintOut method to offer the features included in the Print Dialog.

Another approach that may seem a bit unusual is used to generate a report that includes a map. When the report is opened, the application first saves the map as a web page and then strips out the GIF file that is used in the Access report.

Let’s first take a look at using MapPoint in Access without using the OCX. This can be done using the Windows API functions that are prototyped in “basMain” of the application. Once an instance of MapPoint is opened using CreateObject, the windows handle to MapPoint can be acquired using the FindWindow API call. This is demonstrated in Function LoadMap() which can be found in the code behind form “frmMain”. The handle is stored in a global variable and is subsequently used when the Map form “frmMap” is opened. The Map form contains a subform call “fsubMap”. In the On_Load event of the subform, the SetParent API call is made passing in the MapPoint windows handle and the handle to the subform. This call forces the MapPoint application to be displayed with the subform. Notice also in the subform’s Resize_Event that the MapPoint WindowState is maximized. This forces the MapPoint to retain the size of the subform.

Now it appears that MapPoint is built into Access and all the functionality of MapPoint is at the user’s fingertips.

For the most part, that is how it works. Some of the details are not described here but should be fairly clear after reviewing the code.

Once the map is opened, a report can be generated. When the “Generate Report” command button is clicked, the SaveAs method (which is not available when using the OCX) is used to save the map as a web page to the directory where the Home Locator application is located. The generated directory contains the map in GIF format. The application copies the GIF file to “map.gif” in the Home Locator directory before deleting the directory created when the SaveAs method was executed. Now that the map exists in GIF format at a predefined location, it can be used in a report. In this application the report’s picture is set to reference the GIF file in the report’s Report_Open event when the report is opened. That’s it. Take a look at the report’s Picture Alignment property to reposition the map on the report.

More times than not there are multiple ways to accomplish a given task when developing Windows applications. This holds true when developing with MapPoint. Hopefully, this article has given you some ideas on how to use MapPoint in developing integrated solutions.

By the way, there is additional code in the application that was not described here that may be helpful to you. Please feel free to send me your comments or any enhancements you may have.

Downloads:
  - homelocator.zip

Discuss this story in the forum.

Author: John Washenberger
Email: jwash(AT)seadak.com
URL: http://www.seadak.com
John is a Software Development Consultant for SeaDak Solutions, Inc. located on Bainbridge Island, WA which specializes in developing Microsoft integrated office and database solutions.



Google
 
MP2Kmag Internet


 Recent Discussion
-Export Zip Codes Along A Route
-Importing from Excel troubleshooting
-MP 2009 Pushpin Question
-Add-In Development Goes Sour
-MVP
-Route Optimization in Bing Maps powered by OnTerra’s free Stop Optimization Service
-Newbie Fail - Please Help
-Find road traffic details
-Convert a territory to a shape?
-Imagine Cup 2009 – Team Croatia Builds GeoScout with Bing Maps
-Maponics Adds Infusion Development and MapMart to Distributor Network
-Mappoint updates
-Mappoint 2006 history list???
-Trying to optimize my route
-Finding zipcodes (or other territory descriptions)
-Is MapPoint 2009 capable????
-Rendering Historic Maps on Bing
-Spatial-Enabled Windows Azure (Part 1)
-Spatial-Enabled Windows Azure (Part 2)
-MapPoint 2009 - Discovery GPS's COM Port
-Territory export. 3 Digit Zips and State
-TrekWireless Shows Electric Car Charging Points on Bing Maps
-I'm back
-Embed Chart into Mappoint2009
-BBC Goes Big on Bing Maps
 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-2009 MP2K. Questions and comments to: website@mp2kmag.com
  Microsoft and MapPoint 2002/2004/2006/2009 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 Cartridges 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 UK, Car Lease and Contract Hire