You have to use some navigation software API, ie Google Maps API, to get the way points and then calculate the sum of the distances between the way points (or just query the navigation API for the distance):
Some Windows Mobile/Windows CE navigation software also provides API for this calculation, ie ALK CoPilot, these work also offline, whereas Gooogle API needs an online internet connection.