←Select platform

EnumFormats Method

Summary
Enumerates all of the available WIA driver transfer formats.

Syntax
C#
C++/CLI
Python
public void EnumFormats( 
   object item, 
   WiaEnumFormatsFlags flags 
) 
public: 
void EnumFormats(  
   Object^ item, 
   WiaEnumFormatsFlags flags 
)  
def EnumFormats(self,flags): 

Parameters

item
Handle to the item having its supported transfer formats enumerated. Retrieve this parameter by either calling the GetRootItem method to get the device's root item itself, or by enumerating the child items of the device through a call to EnumChildItems method.

flags
Reserved for future use. Pass WiaEnumFormatsFlags.None.

Remarks

This function will enumerate all of the available WIA driver transfer formats for the specified item.

Each enumerated transfer format will be sent to the user through the EnumFormatsEvent event. Add this event when enumerating the device's transfer formats. To cancel the enumeration proces, add the EnumFormatsEvent event and then set the Cancel member of the WiaEnumFormatsEventArgs to true.

For more information, refer to Managing WIA Sources.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Wia; 
 
 
       
public void EnumFormatsExample(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.EnumFormatsEvent += new EventHandler<WiaEnumFormatsEventArgs>(wiaSession_EnumFormatsEvent); 
 
   object rootItem = wiaSession.GetRootItem(null); 
   if (rootItem != null) 
   { 
      wiaSession.EnumFormats(rootItem, WiaEnumFormatsFlags.None); 
   } 
 
   wiaSession.EnumFormatsEvent -= new EventHandler<WiaEnumFormatsEventArgs>(wiaSession_EnumFormatsEvent); 
 
   wiaSession.Shutdown(); 
} 
 
void wiaSession_EnumFormatsEvent(object sender, WiaEnumFormatsEventArgs e) 
{ 
   string strMsg = string.Empty; 
 
   strMsg = string.Format("WIA Formats count = {0}\n", e.FormatsCount); 
   Console.WriteLine(strMsg); 
 
   // print out the received formats into the console window. 
   if (e.FormatsCount > 0) 
   { 
      Guid formatGuid = WiaSession.GetFormatGuid(e.Format); 
      strMsg = string.Format("WIA Format: {0}\nWIA Format Transfer Mode: {1}\nWIA Format Guid: \n\n", e.Format.ToString(), e.TransferMode.ToString(), formatGuid); 
      Console.WriteLine(strMsg); 
   } 
} 
Requirements

Target Platforms

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

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