A version of this page is also available for
This function retrieves location information, including latitude and longitude, by setting the fields of the passed GPS_POSITION structure with location information that meets the specified maximum age criteria.
DWORD GPSGetPosition( HANDLE hGPSDevice, GPS_POSITION *pGPSPosition, DWORD dwMaximumAge, DWORD dwFlags );
Handle returned by a call to GPSOpenDevice, or NULL.
If NULL, the GPS Intermediate Driver returns cached location fix data that is within the dwMaximumAge, if available; otherwise, the dwValidFields of &pGPSPosition will contain zeroes on return.
Pointer to a GPS_POSITION structure. On return, this structure is filled with location data obtained by the GPS Intermediate Driver. The dwValidFields member of the GPS_POSITION instance specifies which fields of the instance are valid. This structure must be properly initialized, otherwise an error will be returned.
Maximum age, in milliseconds, of location information. The GPS Intermediate Driver only returns information that has been received within the time specified by this parameter. Any information that is older than this age is not returned. The elements of the GPS_POSITION instance that are valid for the given dwMaximumAge value are specified in the dwValidFields element of the instance.
Reserved. Must be 0.
If successful, returns ERROR_SUCCESS.
If unsuccessful, returns an error code.
Applications call this function in three scenarios:
- an event passed in GPSOpenDevice, hNewLocationData parameter is signaled
- the application is in a polling loop, or
- a single time and then close the device using GPSCloseDevice.
GPSGetPosition does not query the GPS device directly to determine the current position. Instead, it will read the last position that the GPS device indicated to the GPS Intermediate Driver. The GPS device will indicate a position to the GPS Intermediate Driver in the background, independently of calls to GPSGetPosition.
|Windows Embedded CE||Windows Embedded CE 6.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|