In This Topic
WIA device manager allows to get the device list programmatically. Device list can be obtained using
WiaDeviceManager.Devices property. Information about an opened device can be obtained using
WiaDeviceManager.OpenedDevice property.
Here is an example that demonstrates how to open WIA device manager and display information about all available WIA devices:
/// <summary>
/// Opens WIA device manager and displays information about available WIA image scanners.
/// </summary>
void GetWiaDevicesInfo()
{
// create WIA device manager
using (Vintasoft.WiaImageScanning.WiaDeviceManager deviceManager = new Vintasoft.WiaImageScanning.WiaDeviceManager())
{
// open device manager
deviceManager.Open();
Vintasoft.WiaImageScanning.WiaDeviceCollection devices = deviceManager.Devices;
// for each WIA device
for (int i = 0; i < devices.Count; i++)
{
// output the device name
System.Console.WriteLine(string.Format("Device '{0}'", devices[i].Name));
}
}
}
''' <summary>
''' Opens WIA device manager and displays information about available WIA image scanners.
''' </summary>
Private Sub GetWiaDevicesInfo()
' create WIA device manager
Using deviceManager As New Vintasoft.WiaImageScanning.WiaDeviceManager()
' open device manager
deviceManager.Open()
' get count of WIA devices
Dim deviceCount As Integer = deviceManager.Devices.Count
If deviceCount = 0 Then
System.Console.WriteLine("Devices are not found.")
Return
End If
Dim devices As Vintasoft.WiaImageScanning.WiaDeviceCollection = deviceManager.Devices
' for each WIA device
For i As Integer = 0 To devices.Count - 1
' output the device name
System.Console.WriteLine(String.Format("Device '{0}'", devices(i).Name))
Next
End Using
End Sub