UsbGetHandle Procedure |
Version 7 |
Returns the Windows handle of a specified USB device endpoint specified by a pipe or endpoint address.
[ lHandle = ] UsbGetHandle ( hDevice, enPipeType, lEndpointAddress)
The UsbGetHandle procedure syntax has the following parts:
Name |
Type |
Description |
lHandle |
Windows handle to the USB device |
|
hDevice |
Handle to the USB device |
|
enPipeType |
[Val] enumAUsbPipeTypes |
Specified pipe type of the current interface. |
lEndpointAddress |
[Val] Long |
Specified endpoint address. Default = -1 (Not Used) |
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.
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)