VERSION 5.00 Begin VB.Form DetectForm Caption = "Select Device" ClientHeight = 4560 ClientLeft = 6795 ClientTop = 4485 ClientWidth = 5010 LinkTopic = "Form2" ScaleHeight = 4560 ScaleWidth = 5010 Begin VB.TextBox Message Height = 1695 Left = 120 TabIndex = 3 Text = "Text1" Top = 2640 Width = 4695 End Begin VB.CommandButton Redetect Caption = "Redetect" Height = 495 Left = 3360 TabIndex = 2 Top = 1200 Width = 1335 End Begin VB.CommandButton Go Caption = "Go" Height = 495 Left = 3360 TabIndex = 1 Top = 240 Width = 1335 End Begin VB.ListBox deviceList Height = 2205 Left = 0 TabIndex = 0 Top = 0 Width = 2775 End End Attribute VB_Name = "DetectForm" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim DeviceOK(8) As Boolean Dim Found As Boolean Public DeviceIndex As Long Private Sub Form_Load() DeviceIndex = -1 Redetect_Click End Sub Private Sub Go_Click() DeviceIndex = deviceList.ListIndex If DeviceIndex > -1 And DeviceIndex < 8 Then If DeviceOK(DeviceIndex) = False Then Message.Text = "Please select a valid device from the list" DeviceIndex = -1 Else Unload Me End If Else DeviceIndex = -1 Message.Text = "Please select a valid device from the list" End If End Sub Private Sub Redetect_Click() Dim deviceMask As Long Dim pPID As Long Dim temp As Long Dim nom As String Dim Count As Integer deviceList.Clear Found = False deviceMask = GetDevices For Count = 0 To 7 DeviceOK(Count) = False If deviceMask Mod 2 = 1 Then QueryDeviceInfo Count, pPID, 0, 0, 0, 0 Select Case pPID Case 32784 '&H8018 nom = "USB-IDIO-16" DeviceOK(Count) = True Found = True Case Else nom = "" End Select Else nom = "" End If deviceList.AddItem nom, Count deviceMask = ShiftRight(deviceMask, 1) Next Count If Found = True Then Message.Text = "Select the device you want to work with and click Go" Else Message.Text = "No compatible devices found." End If End Sub