Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Retrieving a Location Object

To retrieve a location object, you use the ILocation interface. You can think of this interface as the root interface for the Location API. To use ILocation, you must first call the COM CoCreateInstance method.

The following example code creates an instance of the location object.

// Declare a smart pointer to receive the 
// location interface pointer.
CComPtr<ILocation> spLocation;

// Create the location object.
hr = spLocation.CoCreateInstance(CLSID_Location);

After successfully retrieving the location object, you can retrieve location reports, or register to handle report events.

Related topics

The Location Object in C++
Location Reports in C++
Polling for Location Reports
Location Events in C++
Responding to Location Report Events



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.