Another way to use the server is to build many complex trips with multiple stops and various options. For example, you could generate two trips from New York to San Diego via Chicago and Phoenix, using PRACTICAL routing for one and SHORTEST for the other, and then compare them.


To use a trip, you must first ask the server for a new trip.  A Trip identifier is defined as a four byte pointer:


HRESULT PCRSNewTrip (Trip *tripID)


PCRSNewTrip() places a handle to the new trip in the pointer argument passed in (tripID). The return code is the same as all other DLL functions (used for error handling). 


You can create up to eight simultaneous trips. When finished with the trip, you should call PCRSDeleteTrip() to clean up the trip’s memory. If you don’t, you may not be able to create more trips if you have eight trips open at once.



HRESULT PCRSDeleteTrip(Trip trip)


PCRSDeleteTrip() returns a negative error code on error.


Once the trip is created, you can do simple calculations with a trip, or more complex ones. PCRSCalcTrip remains an all-in-one function while complex, multi-stop trips can be built using PCRSAddStop / PCRSDeleteStop and calculated using PCRSCalculate.