位置API在Windows 10上的桌面应用程序c++

Location API on Windows 10 for Desktop applications C++

本文关键字:桌面 应用程序 c++ API Windows 位置      更新时间:2023-10-16

似乎位置API是遗留的(?)。它不工作的GetReport(…),但工作正常,如果你设置RegisterForReport(…)我得到的错误如下

driversmobilepclocationconvergenceapiwinlegacyapidllapilegacyapiimpltemplate.h(197)LocationApi.dll!06552CA7: (caller: 06552D34) ReturnHr[PreRelease](1) tid(478) 8007139F The group or resource is not in the correct state to perform the requested operation.
    [CLocationApiImplTemplate<class CLegacyPositionRequest,&struct __s_GUID const _GUID_e4e915a9_8344_4f88_9326_2adc071d4ff6>::GetReportInterval(!m_fRegistered)]
SalesMan::AGW_CLASS::AGWLocationWin8::GetLocation> HR=8007139F
SalesMan::AGW_CLASS::AGWLocationWin8::GetLocation> reportInterval=0
driversmobilepclocationconvergenceapiwinlegacyapidllapilegacyapiimpltemplate.h(158)LocationApi.dll!06554401: (caller: 06554448) ReturnHr[PreRelease](2) tid(478) 800700E8 The pipe is being closed.
    [CLocationApiImplTemplate<class CLegacyPositionRequest,&struct __s_GUID const _GUID_e4e915a9_8344_4f88_9326_2adc071d4ff6>::GetReport(m_pLatLongReport == nullptr)]
driversmobilepclocationconvergenceapiwinlegacyapidllapilegacypositionrequest.cpp(80)LocationApi.dll!06554469: (caller: 06552BF2) ReturnHr[PreRelease](3) tid(478) 800700E8 The pipe is being closed.
    [CLegacyPositionRequest::GetReport(__super::GetReport(ReportType, ppLocationReport))]

我必须在这里说,RequestPermissions(…)工作正常,返回OK。同样的应用程序在windows 8.1上运行良好。有人知道吗?

提前谢谢你乔治

我通过实现事件驱动的位置报告绕过了这个问题。可能Windows 10的初始化速度比Windows 8慢,因为硬件是一样的。我给它一个3秒的报告间隔,然后报告纬度

乔治