Condividi tramite


Metodo ILocationEvents::OnStatusChanged (locationapi.h)

[L'API Location Win32 è disponibile per l'uso nei sistemi operativi specificati nella sezione Requisiti. È possibile che in versioni successive sia stata modificata o non sia più disponibile. Usare invece l'API Windows.Devices.Geolocation . ]

Chiamato quando viene modificato lo stato di un report.

Sintassi

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

Parametri

[in] reportType

REFIID che specifica l'ID interfaccia del tipo di report per cui lo stato è stato modificato.

[in] newStatus

Costante dell'enumerazione LOCATION_REPORT_STATUS che contiene il nuovo stato.

Valore restituito

Se questo metodo ha esito positivo, restituisce S_OK. In caso contrario, restituisce un codice di errore HRESULT .

Commenti

Questo evento fornisce lo stato del report per i nuovi report. I report più recenti rimangono disponibili tramite ILocation::GetReport, indipendentemente dallo stato segnalato da questo evento.

Esempio

Di seguito è riportata un'implementazione di esempio di OnStatusChanged che gestisce gli eventi di modifica dello stato per i report di latitudine/longitudine.

// 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;
}

Requisiti

   
Client minimo supportato Windows 7 [solo app desktop],Windows 7
Server minimo supportato Nessuno supportato
Piattaforma di destinazione Windows
Intestazione locationapi.h
DLL LocationAPI.dll

Vedi anche

ILocationEvents