Access the GPS Pane via C#

srogillio
10-03-2006, 02:17 PM
One of the cool feature of MP 2006 was the improve GPS tracking and the all new Voice Directions. That was a GOOD improvement. The BAD is the API does not provide a new enumeration for GeoPaneState So after some reading and surfing I found some VB6 code from Sergiy Pavlov I used SPY++ to write a small class that toggle the GPS Pane on and off. From this sample code you should be able to access addition MP features that are not included in the API. To find other features, open MapPoint 2006 and then start SPY++. Use the Find Window tool and then start loging on that window. However be sure to limit the logging to only the WM_COMMAND unless you are interested in other messages.

After I open MP 2006 and type [ctrl]A. The GPS panel appear and SPY++ logs

00290B60 S WM_COMMAND wNotifyCode:1(sent from accel) wID:35037

Now I have the code to submit to toggle the GPS pane

public void ToggleGPSPane()
{
if (this.myMpHandle != 0)
{
SendMessage(this.myMpHandle, WM_COMMAND, SHOW_GPS_PANE, 0);
}
}


where
private const int WM_COMMAND = 0x0111;

private const int SHOW_GPS_PANE = 35037;

The attach code should compile and be a starter for additional work.

Enjoy
Scott

renatoa
05-13-2008, 02:26 AM
I succeeded to make this work, but everything in the GPS pane is dimmed, including "Start GPS tracking" checkbox...
Pressing "Configure GPS..." and nothing happens.
Any idea ?

Renato

srogillio
05-13-2008, 08:03 AM
Unfortunately that is the road block I hit after I posted the original message. I worked on this for quite awhile with no success. I am thinking when the GPS pane initializes it check whether to see if the parent is the MapPoint exe or the 'control' and behaves differently (disabled) if the 'control' is the parent.

If you are able to get past this please post your solution.

Scott

 
Web mp2kmag.com
mapforums.com