HidD_SetFeature function (hidsdi.h)
The HidD_SetFeature routine sends a feature report to a top-level collection.
Syntax
BOOLEAN HidD_SetFeature(
[in] HANDLE HidDeviceObject,
[in] PVOID ReportBuffer,
[in] ULONG ReportBufferLength
);
Parameters
[in] HidDeviceObject
An open handle to a top-level collection.
[in] ReportBuffer
Pointer to a caller-allocated feature report buffer that the caller uses to specify a HID report ID.
For more information about this parameter, see the Remarks section.
[in] ReportBufferLength
The size of the report buffer in bytes. The report buffer must be large enough to hold the feature report plus one additional byte that specifies a nonzero report ID. If report ID is not used, the ID value is zero.
Return value
If HidD_SetFeature succeeds, it returns TRUE; otherwise, it returns FALSE. Use GetLastError to get extended error information.
Remarks
The correct ReportBufferLength is specified by the FeatureReportByteLength member of a top-level collection's HIDP_CAPS structure returned from HidP_GetCaps call.
Before it calls the HidD_SetFeature routine, the caller must do the following:
- If the top-level collection includes report IDs, the caller must set the first byte of the ReportBuffer parameter to a nonzero report ID.
- If the top-level collection does not include report IDs, the caller must set the first byte of the ReportBuffer parameter to zero.
- The feature report is referenced by the ReportBuffer parameter. Depending on the report ID, the caller prepares the report by calling one of the following functions:
For an example of how to prepare and a HID report and send it to a top-level collection, see the HClient sample application.
Only user-mode applications can call HidD_SetFeature. Kernel-mode drivers can use an IOCTL_HID_SET_FEATURE request.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available in Windows 2000 and later versions of Windows. |
Target Platform | Universal |
Header | hidsdi.h (include Hidsdi.h) |
Library | Hid.lib |
DLL | Hid.dll |