ILocationEvents::OnStatusChanged method (locationapi.h)

[The Win32 Location API is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use the Windows.Devices.Geolocation API. ]

Called when a report status changes.

Syntax

HRESULT OnStatusChanged(
  [in] REFIID                 reportType,
  [in] LOCATION_REPORT_STATUS newStatus
);

Parameters

[in] reportType

REFIID that specifies the interface ID of the report type for which the status has changed.

[in] newStatus

A constant from the LOCATION_REPORT_STATUS enumeration that contains the new status.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

This event provides report status for new reports. The most recent reports remain available through ILocation::GetReport, regardless of the status reported by this event.

Examples

The following is a sample implementation of OnStatusChanged that handles status changed events for latitude/longitude reports.

// This is called when the status of a report type changes.
// The LOCATION_REPORT_STATUS enumeration is defined in LocApi.h in the SDK
STDMETHODIMP CLocationEvents::OnStatusChanged(REFIID reportType, LOCATION_REPORT_STATUS status)
{
    if (IID_ILatLongReport == reportType)
    {
        switch (status)
        {
        case REPORT_NOT_SUPPORTED:
            wprintf(L"\nNo devices detected.\n");
            break;
        case REPORT_ERROR:
            wprintf(L"\nReport error.\n");
            break;
        case REPORT_ACCESS_DENIED:
            wprintf(L"\nAccess denied to reports.\n");
            break;
        case REPORT_INITIALIZING:
            wprintf(L"\nReport is initializing.\n");
            break;
        case REPORT_RUNNING:
            wprintf(L"\nRunning.\n");
            break;
        }
    }
    else if (IID_ICivicAddressReport == reportType)
    {
    }

    return S_OK;
}

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only],Windows 7
Minimum supported server None supported
Target Platform Windows
Header locationapi.h
DLL LocationAPI.dll

See also

ILocationEvents