UsbOpen Procedure |
Version 7 |
Opens a USB device for I/O and returns the handle to the opened device.
[ lHandle = ] UsbOpen (dwVendorId, dwProductId, [sSerialNumber])
The UsbOpen procedure syntax has the following parts:
Name |
Type |
Description |
lHandle |
Handle of opened device |
|
dwVendorId |
Val DWord |
USB Vendor ID |
dwProductId |
Val DWord |
USB Product ID |
sSerialNumber |
[Val] BString |
Device Serial Number (optional) |
USB vendor ID, product ID, and Serial Number are used to identify a USB device.
If you do not know these informations, open the Device Manager from the Windows' Control Panel, find your device on the list and then double click the device to open the properties window, select "Device Instance Id" from Details tab page, the four characters to the right of "VID_" and "PID_" are your vendor ID and product ID, respectively. Alternatively, you can obtain the information using ATEasy driver shortcut's property page if the selected driver has been configured to support USB. The devices address information is also displayed in the ATEasy Driver Shortcut Interfaces page when you configure a USB based driver.
If there are more than one devices with the same vendor ID and product ID, then serial number will be used to uniquely identify the device; otherwise, it is ignored.
Calling UsbOpen for the first time on a USB device will require local administrator privilege (Run ATEasy or your ATEasy application as administrator) . The ATEasy run-time will attach a filter device driver to the existing device driver that will allow ATEasy to communicate with the device.
The following example opens Keithley 2100 DMM :
hDevice = UsbOpen(0x5E6, 0x2100, "1149137")