UsbGetHandle Procedure

Version 7

 

Returns the Windows handle of a specified USB device endpoint specified by a pipe or endpoint address.

Syntax

[ lHandle = ] UsbGetHandle ( hDevice, enPipeType, lEndpointAddress)

The UsbGetHandle procedure syntax has the following parts:

 

Name

Type

Description

lHandle

AHandle

Windows handle to the USB device

hDevice

AHandle

Handle to the USB device

enPipeType

[Val] enumAUsbPipeTypes

Specified pipe type of the current interface.
Default = UsbPipeTypeControl

lEndpointAddress

[Val] Long

Specified endpoint address. Default = -1 (Not Used)

Remarks

If endpoint address is specified (>=0), then the pipe handle of the specified endpoint is returned; otherwise, the handle of the first endpoint with the specified pipe type of the current interface is returned.

The returned handle can be used with Windows API WriteFile, ReadFile to send or receive data to/from an endpoint pipe respectively.

Example

The following examples demonstrate how to retrieve the pipe handle specifying endpoint address :

hPipe = UsbGetHandle(hDevice, , 0x83)

or specifying pipe type :

hPipe = UsbGetHandle(hDevice, aUsbPipeTypeBulkIn)

See Also

UsbOpen, UsbSetup, enumAUsbPipeTypes