←Select platform

EnumDevicesEvent Event

Summary
Occurs for each found WIA device after calling the EnumDevices method.

Syntax
C#
C++/CLI
Python
public event EventHandler<WiaEnumDevicesEventArgs> EnumDevicesEvent 
public: 
event EventHandler<WiaEnumDevicesEventArgs^>^ EnumDevicesEvent 
def EnumDevicesEvent(sender,e): # sender: WiaSession e: WiaEnumDevicesEventArgs 
Event Data

The event handler receives an argument of type WiaEnumDevicesEventArgs containing data related to this event. The following WiaEnumDevicesEventArgs properties provide information specific to this event.

PropertyDescription
DeviceDesc Gets the description of the device being enumerated.
DeviceID Gets the ID string for the enumerated device.
DeviceName Gets the name of the enumerated device.
Stop Enables or disables firing the EnumDevicesEvent event.
Remarks

This event will be called while enumerating the available WIA devices after calling the EnumDevices method to provide the user with information about each found device and also gives the ability to abort the enumeration process.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Wia; 
 
 
       
public void EnumDevicesExample(IntPtr parent) 
{ 
   if (!WiaSession.IsAvailable(WiaVersion.Version1)) 
   { 
      Console.WriteLine("WIA version 1.0 not installed."); 
      return; 
   } 
 
   WiaSession wiaSession = new WiaSession(); 
   wiaSession.Startup(WiaVersion.Version1); 
 
   DialogResult res = wiaSession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault); 
   if (res != DialogResult.OK) 
   { 
      Console.WriteLine("Error selecting WIA device."); 
      wiaSession.Shutdown(); 
      return; 
   } 
 
   wiaSession.EnumDevicesEvent += new EventHandler<WiaEnumDevicesEventArgs>(wiaSession_EnumDevicesEvent); 
 
   Console.WriteLine("Available WIA Devices:\n"); 
   wiaSession.EnumDevices(); 
 
   wiaSession.EnumDevicesEvent -= new EventHandler<WiaEnumDevicesEventArgs>(wiaSession_EnumDevicesEvent); 
 
   wiaSession.Shutdown(); 
} 
 
void wiaSession_EnumDevicesEvent(object sender, WiaEnumDevicesEventArgs e) 
{ 
   string strMsg = string.Empty; 
 
   // print out some information about each device found into the console window. 
   strMsg = string.Format("\tDevice Name: {0}\n\tDevice Id: {1}\n\tDevice Description: {2}\n\n", e.DeviceName, e.DeviceID, e.DeviceDesc); 
   Console.WriteLine(strMsg); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Wia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.