DETECTAR ESCANERES CONECTADOS

Private Sub LoadScanners(c As ComboBox, cID As ComboBox)

        Dim deviceName As String = ""
        c.Items.Clear()

        Dim deviceManager As New WIA.DeviceManager
        'Recorre la lista de disositivos y añadimos el nombre en combobox y el id en un segundo combobox

        For Each info As WIA.DeviceInfo In deviceManager.DeviceInfos
            Dim deviceID As String = info.DeviceID

            If info.Type = WIA.WiaDeviceType.ScannerDeviceType Then
                For Each p As WIA.Property In info.Properties
                    If p.Name = "Name" Then
                        deviceName = DirectCast(p, WIA.IProperty).Value.ToString()
                        c.Items.Add(deviceName)
                        cID.Items.Add(deviceID)
                    End If
                Next

            End If
        Next


   End Sub

No hay comentarios:

Publicar un comentario