[Win32 位置 API 可用於需求一節中指定的作業系統。 它在後續版本中可能會變更或無法使用。 請改用 Windows.Devices.Geolocation API。 ]
報表狀態變更時呼叫。
語法
HRESULT OnStatusChanged(
[in] REFIID reportType,
[in] LOCATION_REPORT_STATUS newStatus
);
參數
[in] reportType
REFIID ,指定狀態已變更之報表類型的介面識別碼。
[in] newStatus
包含新狀態 之 LOCATION_REPORT_STATUS 列舉中的常數。
傳回值
如果此方法成功,則會傳回 S_OK。 否則,它會傳回 HRESULT 錯誤碼。
備註
此事件會提供新報表的報表狀態。 不論此事件所報告的狀態為何,最新的報告仍可透過 ILocation::GetReport取得。
範例
以下是 OnStatusChanged 的範例實作,可處理經緯度/經度報告的狀態變更事件。
// 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;
}
需求
| 最低支援的用戶端 | Windows 7 [僅限傳統型應用程式],Windows 7 |
| 最低支援的伺服器 | 都不支援 |
| 目標平台 | Windows |
| 標頭 | locationapi.h |
| Dll | LocationAPI.dll |