Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Use the UWP Sensor API instead.
The COM-based Sensor API is deprecated and should not be used in new applications. No additional features or enhancements are planned, and support will be limited.
Retrieves a single data field value from the data report.
Syntax
HRESULT GetSensorValue(
  [in]  REFPROPERTYKEY pKey,
  [out] PROPVARIANT    *pValue
);
Parameters
[in] pKey
REFPROPERTYKEY indicating the data field to retrieve.
[out] pValue
Address of a PROPVARIANT that receives the data field value.
Return value
This method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
| Return code | Description | 
|---|---|
| 
 | The method succeeded. | 
| 
 | The data field was not found. | 
| 
 | NULL was passed in for pValue. | 
Remarks
Platform-defined data field PROPERTYKEYs are defined in Sensors.h.
Examples
For an example of how to retrieve a sensor data field value, see Retrieving Sensor Data Values.
Requirements
| Requirement | Value | 
|---|---|
| Minimum supported client | Windows 7 [desktop apps only] | 
| Minimum supported server | None supported | 
| Target Platform | Windows | 
| Header | sensorsapi.h | 
| Library | Sensorsapi.lib | 
| DLL | Sensorsapi.dll |