←Select platform

WiaVariableTypes Enumeration

Summary
Flags used within WiaCapability structure. For more information refer to VARENUM in Microsoft Windows SDK Documentation.

Syntax
C#
C++/CLI
Python
[FlagsAttribute()] 
public enum WiaVariableTypes 
[FlagsAttribute()] 
public enum class WiaVariableTypes : public System.Enum, System.IComparable, System.IConvertible, System.IFormattable   
class WiaVariableTypes(Enum): 
   Empty = 0 
   Null = 1 
   I2 = 2 
   I4 = 3 
   R4 = 4 
   R8 = 5 
   Cy = 6 
   Date = 7 
   Bstr = 8 
   Dispatch = 9 
   Error = 10 
   Bool = 11 
   Variant = 12 
   Unknown = 13 
   Decimal = 14 
   I1 = 16 
   UI1 = 17 
   UI2 = 18 
   UI4 = 19 
   I8 = 20 
   UI8 = 21 
   Int = 22 
   UInt = 23 
   Void = 24 
   HResult = 25 
   Ptr = 26 
   SafeArray = 27 
   CArray = 28 
   UserDefined = 29 
   Lpstr = 30 
   Lpwstr = 31 
   Record = 36 
   IntPtr = 37 
   UIntPtr = 38 
   FileTime = 64 
   Blob = 65 
   Stream = 66 
   Storage = 67 
   StreamedObject = 68 
   StoredObject = 69 
   BlobObject = 70 
   CF = 71 
   Clsid = 72 
   VersionedStream = 73 
   IllegalMasked = 4095 
   IllegalMasked = 4095 
   IllegalMasked = 4095 
   Vector = 4096 
   Array = 8192 
   ByRef = 16384 
   Reserved = 32768 
   Illegal = 65535 
Members
ValueMemberDescription
0x00000000EmptyVT_EMPTY
0x00000001NullVT_NULL
0x00000002I2(0x00000012)VT_I2
0x00000003I4(0x00000013)VT_I4
0x00000004R4VT_R4
0x00000005R8VT_R8
0x00000006CyVT_CY
0x00000007DateVT_DATE
0x00000008BstrVT_BSTR
0x00000009DispatchVT_DISPATCH
0x0000000AErrorVT_ERROR
0x0000000BBoolVT_BOOL
0x0000000CVariantVT_VARIANT
0x0000000DUnknownVT_UNKNOWN
0x0000000EDecimalVT_DECIMAL
0x00000010I1(0x00000011)VT_I1
0x00000011UI1VT_UI1
0x00000012UI2VT_UI2
0x00000013UI4VT_UI4
0x00000014I8(0x00000015)VT_I8
0x00000015UI8VT_UI8
0x00000016Int(0x00000017)VT_INT
0x00000017UIntVT_UINT
0x00000018VoidVT_VOID
0x00000019HResultVT_HRESULT
0x0000001APtr(0x00000025)(0x00000026)VT_PTR
0x0000001BSafeArrayVT_SAFEARRAY
0x0000001CCArrayVT_CARRAY
0x0000001DUserDefinedVT_USERDEFINED
0x0000001ELpstrVT_LPSTR
0x0000001FLpwstrVT_LPWSTR
0x00000024RecordVT_RECORD
0x00000025IntPtr(0x00000026)VT_INT_PTR
0x00000026UIntPtrVT_UINT_PTR
0x00000040FileTimeVT_FILETIME
0x00000041Blob(0x00000FFF)VT_BLOB
0x00000042Stream(0x00000049)VT_STREAM
0x00000043StorageVT_STORAGE
0x00000044StreamedObjectVT_STREAMED_OBJECT
0x00000045StoredObjectVT_STORED_OBJECT
0x00000046BlobObjectVT_BLOB_OBJECT
0x00000047CFVT_CF
0x00000048ClsidVT_CLSID
0x00000049VersionedStreamVT_VERSIONED_STREAM
0x00000FFFIllegalMaskedVT_ILLEGALMASKED
0x00000FFFTypeMaskVT_TYPEMASK
0x00000FFFBstrBlobVT_BSTR_BLOB
0x00001000VectorVT_VECTOR
0x00002000Array(0x0000001C)(0x00002000)VT_ARRAY
0x00004000ByRefVT_BYREF
0x00008000ReservedVT_RESERVED
0x0000FFFFIllegalVT_ILLEGAL
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.