WinUsb_SetCurrentAlternateSetting function (winusb.h)

The WinUsb_SetCurrentAlternateSetting function sets the alternate setting of an interface.

Syntax

BOOL WinUsb_SetCurrentAlternateSetting(
  [in] WINUSB_INTERFACE_HANDLE InterfaceHandle,
  [in] UCHAR                   SettingNumber
);

Parameters

[in] InterfaceHandle

An opaque handle to an interface, which defines the alternate setting to set.

To set an alternate setting in the first interface on the device, use the interface handle returned by WinUsb_Initialize. For all other interfaces, use the handle to the target interface, retrieved by WinUsb_GetAssociatedInterface.

[in] SettingNumber

The value that is contained in the bAlternateSetting member of the USB_INTERFACE_DESCRIPTOR structure. This structure is populated by the WinUsb_QueryInterfaceSettings routine.

Return value

WinUsb_SetCurrentAlternateSetting returns TRUE if the operation succeeds. Otherwise, this function returns FALSE, and the caller can retrieve the logged error by calling GetLastError.

GetLastError can return the following error code.

Return code Description
ERROR_INVALID_HANDLE
The caller passed NULL in the InterfaceHandle parameter.

Remarks

WinUsb_SetCurrentAlternateSetting fails if outstanding I/O requests are present on the interface.

Requirements

Requirement Value
Target Platform Universal
Header winusb.h (include Winusb.h)
Library Winusb.lib
DLL Winusb.dll

See also

USB_INTERFACE_DESCRIPTOR

WinUSB

WinUSB Functions

WinUsb_Initialize

WinUsb_QueryInterfaceSettings