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 2006
Press Releases
MapPoint Forums
Companies
Link to MP2Kmag
Wish List
MapPoint Trial
Authors
 Sponsors
 Order

MapPoint 2006

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
ViaVirtualEarth
SVG Tutorials
MapPoint

Map Visitors

 Direct Media

IT support
Connect.co.uk provides top-notch IT Support for small and medium-sized enterprises.

ink uk
Thinking ink? We are UK ink specialists, supplying home business and trade users. When getting ink, get in touch. Ink excellence.

Cheap flights to Madrid
Visit Madrid with bullfighting and the "Golden Triangle of Art" ready for you to view. For cheap flights to Madrid book here.

Tenerife Holidays
Tenerife is one of the last remaining European paradise islands. You can book great cheap holidays at On The Beach.

apartments Bulgaria
Apartments available for sale in ski resorts in an around Bulgaria. Choice of custom build or ready made!

Cheap Flights Miami
The best way to find cheap flights to Miami and many other destinations is to shop around. Use dealchecker.co.uk to compare prices.

Paphos
Vacation to Paphos? This year round destination offers a lively but relaxing holiday. Check out the fabulous deals on Ulookubook.com.

  ARTICLES  


An API to Control MapPoint 2006 GPS Features - Part I of II

Paul Larson shares an API he developed to add programmatic GPS functionality to MapPoint code projects and includes a demo to illustrate how the API works.

With the release of MapPoint 2006 North America (MP2K6NA) earlier this year, many users have been elated with the new map content and the addition of GPS features and Driving Guidance to the product. Likewise, many developers have thus found issue with the lack of improvement to the MapPoint API, specifically in relation to these new features. Being of the latter group, I decided to roll-my-own API to add programmatic GPS functionality to my MapPoint code projects.

Part I of this project will simply encapsulate the standard UI for GPS tracking, centering, rotation, Driving Guidance and GPS-trailing functionality, along with some UI state detection.

Part II of the project will deal with extending the base GPS API by implementing a class to capture the GPS Sensor information. I will also extend the API to handle usage of the ActiveX control version of MP2K6NA.

Using a couple old windows API tricks for cross-process state detection and base window-messaging (out-of-process), it is quite possible to extend an API to control the new GPS features programmatically in MapPoint 2006.

In a standard installation of MP2K6NA, the GPS functionality of the UI is disabled (grayed-out) when a map or template is opened using the MapPoint API. However, according to the product documentation, all pane-states of the application are saved as part of the map or template file. Since the GPS Panel is indeed a pane with state, saving a template with this pane open (and having had the GPS com port configured) does indeed enable GPS functionality when re-opening the file using the API. I have included a base template file with this setting as part of the project, choosing to name it “GPS_ON.ptt.” Furthermore, I have noted that if a map or template is loaded programmatically after the initial load of GPS_ON.ptt, the GPS functionality of the UI remains available.

Hence, to provide our API it is only a matter of encapsulating UI state and sending low-level messages to the UI. Worthy of additional note is that by using the Windows API messaging methodology, we can interact with non-visible controls, which improves user experience and occasionally avoids certain process-blocking issues.

The project was developed using Visual Studio 2003, VB.Net and the .NET Framework version 1.1.4322. For the most part, the project should also load and compile fine in Visual Studio 2005 and the .NET Framework version 2.0.50727 as well. Additionally, I found it rather helpful to use Spy++ to enumerate the MapPoint window structures while working on the code, and the Visual Studio 6.0 API Viewer to delve into and convert the user32.dll WinAPI functions.

Other than finding and storing the proper handles to the controls in the MapPoint application, the only other trick is to send BM_CLICK messages to these windows so as to simulate the user having interacted with the controls. We also use the API method GetWindowInfo() to return visibility and state information about certain controls.

The entire code for the class is included here: mpGPS_API.zip

Finally, being that the API is written as a DLL class module for use in your own MapPoint programming projects, I have included a windows forms-based demo application showing the usage of the API. You can download the demo here: mpGPS_Demo.zip

Click here to join in the discussion of this article on MapForums.com.

Discuss this story in the forum.

Author: Paul Larson
Email: plarsonpma(AT)hotmail.com
Paul Larson is a consulting Developer/Analyst and the owner of Paul Larson LLC in historic Marshall, Michigan. Having started his programming career on a TRS-80 in 1974, he currently has thirty years of software design and development experience in a multitude of fields and technologies. He prefers to think of his MapPoint programming projects as a hobby, and is a frequent contributor to the online newsgroup community for the product: (news://microsoft.public.mappoint).



Google
 
MP2Kmag Internet


 Recent Discussion
-Zillow.com
-ADODB Recordset to MapPoint.DataSet
-Why my new phone isn't an iPhone
-Version 6.0 to 6.1 Auto-Upgrade Alert & V 3-5 Deprecation Reminder
-Accessing MultiMap in the UK. Plus a comparison of UK mapping sites.
-Duplicate double-clicking State name in code?
-Multi-multi-core AMD chips
-Graticule Grids in Virtual Earth
-Location & FindResults not always returning City/State/etc.?
-findout centre of location from a set of long and lat
-How to terminate the process of async webservice method
-Business & trendy mobile phones
-Microsoft Spatial
-Virtual Earth Updates for April 2008
-Twisney
-Where 2.0
-Virtual Earth - Now Hiring
-searching for a map control
-NAVTEQ Announces Semifinalists for the 2008 NAVTEQ Global LBS Challenge® - APAC
-How to detect a particular pushpin
-Photosynth featured on CSI
-DisplayDataMap
-Microsoft Abandoning Yahoo Acquisition
-Microsoft Pro Photo Tools
-Explore Wikipedia with Live Maps
 Resources
Browse GIS books and periodicals
Best Car Contract Hire Lease Save
Find a MapPoint Partner or Consultant
Real Estate Columbia, MO


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
• 5339 - We Know Bikes: Road Bikes / Triathlon Bikes / Mountain Bikes / BMX Bikes
• Buy Your Car Used Cars, Car Lease and Contract Hire