Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Provides methods for discovering and retrieving available sensors and a method to request sensor manager events.
The ISensorManager interface inherits from the IUnknown interface.
The ISensorManager interface has these methods.
ISensorManager::GetSensorByID Retrieves a pointer to the specified sensor. |
ISensorManager::GetSensorsByCategory Retrieves a collection containing all sensors associated with the specified category. |
ISensorManager::GetSensorsByType Retrieves a collection containing all sensors associated with the specified type. |
ISensorManager::RequestPermissions Opens a system dialog box to request user permission to access sensor data. |
ISensorManager::SetEventSink Specifies the interface through which to receive sensor manager event notifications. |
You retrieve a pointer to this interface by calling the COM CoCreateInstance method. If group policy does not allow creation of this object, CoCreateInstance will return HRESULT_FROM_WIN32 (ERROR_ACCESS_DISABLED_BY_POLICY).
The following example code creates an instance of the sensor manager.
// Create the sensor manager.
hr = CoCreateInstance(CLSID_SensorManager,
NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pSensorManager));
if(hr == HRESULT_FROM_WIN32(ERROR_ACCESS_DISABLED_BY_POLICY))
{
// Unable to retrieve sensor manager due to
// group policy settings. Alert the user.
}
Requirement | Value |
---|---|
Minimum supported client | Windows 7 [desktop apps only] |
Minimum supported server | None supported |
Target Platform | Windows |
Header | sensorsapi.h |
Events
May 19, 6 PM - May 23, 12 AM
Calling all developers, creators, and AI innovators to join us in Seattle @Microsoft Build May 19-22.
Register today