GPSGetPosition
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
);
Parameters
hGPSDevice
Handle returned by a call to GPSOpenDevice.This parameter can also be NULL. If NULL, the GPS Intermediate Driver does not turn on the GPS hardware, but does return data if the data has already been received (through some other use of the GPS Intermediate Driver), and the data satisfies the criteria set by the dwMaximumAge parameter. Passing NULL enables applications that can use location information, but do not require it, to retrieve existing data without requiring that the GPS hardware consume power.
pGPSPosition
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.dwMaximumAge
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.dwFlags
Reserved. Must be 0.
Return Values
If successful, returns ERROR_SUCCESS.
If unsuccessful, returns an error code.
Remarks
Applications most commonly call this function when the event passed in the hNewLocationData parameter of the GPSOpenDevice call is signaled. Alternatively, applications can poll using this method, or just call it a single time and then close the device using GPSCloseDevice.
Requirements
OS Versions: Windows CE 5.01 and later**.**
Header: Gpsapi.h.
Link Library: Gpsapi.lib.
See Also
GPS Intermediate Driver Functions | GPS_POSITION | GPSCloseDevice | GPSOpenDevice | GetLastError | Accessing Parsed GPS Data
Send Feedback on this topic to the authors