Error 0x80070002 file not found for ISensorManager->RequestPermissions in Windows

0

I have this strange problem whenever I want to ask permission to use a GPS sensor in Windows. In Visual Studio I do the following:

ISensorManager *SensorM = NULL;                                                      
HRESULT hr = CoCreateInstance(CLSID_SensorManager, NULL, CLSCTX_INPROC_SERVER, IID_ISensorManager, (void**)&SensorM);

Now I can find all GPS sensors attached to the pc.

ISensorCollection *SensorC = NULL;
hr = SensorM->GetSensorsByType(SENSOR_TYPE_LOCATION_GPS, &SensorC);

This finds the connected GPS sensor correctly, but it's state is ACCESS_DENIED (which is what I expect) so I ask for permission to use it.

hr = SensorM->RequestPermissions(NULL, SensorC, TRUE);

However this call always returns HRESULT 0x80070002 (file not found) and does not do anything. I have no know idea why it is doing this and how to solve it. Am I missing something?

c++
windows
visual-studio-2008
sensormanager
asked on Stack Overflow Jan 17, 2018 by Steef

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0