←Select platform

WiaPropertyAttributesFlags Enumeration

Summary
Flags used within WiaCapability structure. For more information refer to "Property Attributes" topic in Microsoft Windows SDK Documentation.

Syntax
C#
C++/CLI
Python
[FlagsAttribute()] 
public enum WiaPropertyAttributesFlags 
[FlagsAttribute()] 
public enum class WiaPropertyAttributesFlags : public System.Enum, System.IComparable, System.IConvertible, System.IFormattable   
class WiaPropertyAttributesFlags(Enum): 
   Read = 1 
   Write = 2 
   ReadWrite = 3 
   None = 8 
   Range = 16 
   List = 32 
   Flag = 64 
   Cashable = 65536 
Members
ValueMemberDescription
0x00000001ReadThe application can read the property's value.
0x00000002Write(0x00000003)The application can write the property's value.
0x00000003ReadWriteThe application can read and write the property's value.
0x00000008NoneThe property does not have any valid values associated with it.
0x00000010RangeThe property has a range of valid values.
0x00000020ListThe property has a list of legal values.
0x00000040FlagThe property has a list of legal flag values. Flag values are combined using a bitwise OR operation.
0x00010000CashableThe device can cache the property's value.
Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Wia; 
 
 
WiaSession session; 
       
public void EnumCapabilitiesExample(IntPtr parent) 
{ 
   if (!WiaSession.IsAvailable(WiaVersion.Version1)) 
   { 
      Console.WriteLine("WIA version 1.0 not installed."); 
      return; 
   } 
 
   session = new WiaSession(); 
   session.Startup(WiaVersion.Version1); 
 
   DialogResult res = session.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault); 
   if (res != DialogResult.OK) 
   { 
      Console.WriteLine("Error selecting WIA device."); 
      session.Shutdown(); 
      return; 
   } 
 
   session.EnumCapabilitiesEvent += new EventHandler<WiaEnumCapabilitiesEventArgs>(wiaSession_EnumCapabilitiesEvent); 
 
   object rootItem = session.GetRootItem(null); 
   if (rootItem != null) 
   { 
      session.EnumCapabilities(rootItem, WiaEnumCapabilitiesFlags.None); 
   } 
 
   session.EnumCapabilitiesEvent -= new EventHandler<WiaEnumCapabilitiesEventArgs>(wiaSession_EnumCapabilitiesEvent); 
 
   session.Shutdown(); 
} 
 
void wiaSession_EnumCapabilitiesEvent(object sender, WiaEnumCapabilitiesEventArgs e) 
{ 
   string strMsg = string.Empty; 
   string strPropAccess = string.Empty; 
   string strPropValue = string.Empty; 
 
   strMsg = string.Format("WIA Capabilities count = {0}\n", e.CapabilitiesCount); 
   Console.WriteLine(strMsg); 
 
   // print out the received capability information into the console window. 
   if (e.CapabilitiesCount > 0) 
   { 
      Console.WriteLine("Capability information:\n"); 
 
      // print out received capability property ID. 
      strMsg = string.Format("Property ID:\t{0}\n", e.Capability.PropertyId.ToString()); 
      Console.WriteLine(strMsg); 
 
      // print out received capability property Name. 
      strMsg = string.Format("Property Name:\t{0}\n", e.Capability.PropertyName); 
      Console.WriteLine(strMsg); 
 
      // print out received capability property access. 
      if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.ReadWrite) == WiaPropertyAttributesFlags.ReadWrite) 
      { 
         strPropAccess += "ReadWrite"; 
      } 
      else 
      { 
         if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.Read) == WiaPropertyAttributesFlags.Read) 
            strPropAccess += "Read"; 
 
         if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.Write) == WiaPropertyAttributesFlags.Write) 
         { 
            if (!string.IsNullOrEmpty(strPropAccess)) 
            { 
               strPropAccess += " | Write"; 
            } 
            else 
            { 
               strPropAccess += "Write"; 
            } 
         } 
      } 
 
      if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.Cashable) == WiaPropertyAttributesFlags.Cashable) 
      { 
         if (!string.IsNullOrEmpty(strPropAccess)) 
         { 
            strPropAccess += " | Cashable"; 
         } 
         else 
         { 
            strPropAccess += "Cashable"; 
         } 
      } 
 
      strMsg = string.Format("Property Access:\t{0}\n", strPropAccess); 
      Console.WriteLine(strMsg); 
 
      // print out received capability property value(s). 
      if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.List) == WiaPropertyAttributesFlags.List) 
      { 
         strPropValue = "Property List Values:\n"; 
         for (int i = 0; i < e.Capability.Values.ListValues.ValuesCount; i++) 
         { 
            if ((e.Capability.VariableType & WiaVariableTypes.Bstr) == WiaVariableTypes.Bstr) 
            { 
               strPropValue = strPropValue + "\t" + Convert.ToString(e.Capability.Values.ListValues.Values[i]) + "\n"; 
            } 
            else if ((e.Capability.VariableType & WiaVariableTypes.Clsid) == WiaVariableTypes.Clsid) 
            { 
               System.Guid guidValue = (System.Guid)e.Capability.Values.ListValues.Values[i]; 
               strPropValue = strPropValue + "\t" + guidValue.ToString() + "\n"; 
            } 
            else 
            { 
               strPropValue = strPropValue + "\t" + (Convert.ToInt32(e.Capability.Values.ListValues.Values[i])).ToString() + "\n"; 
            } 
         } 
      } 
      else if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.Range) == WiaPropertyAttributesFlags.Range) 
      { 
         strPropValue = string.Format("Property Range Values:\n\tMinimum Value: {0}\n\tMaximum Value: {1}\n", e.Capability.Values.RangeValues.MinimumValue, e.Capability.Values.RangeValues.MaximumValue); 
      } 
      else if ((e.Capability.PropertyAttributes & WiaPropertyAttributesFlags.Flag) == WiaPropertyAttributesFlags.Flag) 
      { 
         strPropValue = e.Capability.Values.FlagsValues.FlagValues.ToString(); 
      } 
      else  // The property value is of type "None", and in this case you can retrieve the value by calling the GetPropertyXXX method appropriate for the received variable type. 
      { 
         strPropValue = "Property Value: "; 
 
         object rootItem = session.GetRootItem(null); 
 
         if ((e.Capability.VariableType & WiaVariableTypes.Bstr) == WiaVariableTypes.Bstr) 
         { 
            string stringValue = session.GetPropertyString(rootItem, null, e.Capability.PropertyId); 
            strPropValue += stringValue; 
         } 
         else if ((e.Capability.VariableType & WiaVariableTypes.Clsid) == WiaVariableTypes.Clsid) 
         { 
            Guid guidValue = session.GetPropertyGuid(rootItem, null, e.Capability.PropertyId); 
            strPropValue += guidValue.ToString(); 
         } 
         else 
         { 
            int longValue = session.GetPropertyLong(rootItem, null, e.Capability.PropertyId); 
            strPropValue += longValue.ToString(); 
         } 
      } 
 
      Console.WriteLine(strPropValue); 
   } 
} 
Requirements

Target Platforms

See Also

Reference

Leadtools.Wia Namespace

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.