Enumerates all of the available WIA driver capabilities and properties and determines the available values for each one.
public void EnumCapabilities(object item,Leadtools.Wia.WiaEnumCapabilitiesFlags flags)
Public Sub EnumCapabilities( _ByVal item As Object, _ByVal flags As Leadtools.Wia.WiaEnumCapabilitiesFlags _)
public:void EnumCapabilities(Object^ item,Leadtools.Wia.WiaEnumCapabilitiesFlags flags)
item
Handle to the item to get its capabilities. 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 WiaEnumCapabilitiesFlags.None.
This function will enumerate all of the available WIA driver capabilities and properties (and determine the available values for each one) for the specified acquisition source.
Each enumerated capability will be sent to the user through the EnumCapabilitiesEvent event. Add this event when enumerating the device's capabilities. To cancel the enumeration proces, add the EnumCapabilitiesEvent event and then set the Cancel member of the WiaEnumCapabilitiesEventArgs to true.
For more information, refer to Managing WIA Sources.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.WiaDim session As WiaSession<TestMethod()> _#If Not LEADTOOLS_V19_OR_LATER ThenPublic Sub EnumCapabilitiesExample(ByVal parent As IWin32Window)#ElsePublic Sub EnumCapabilitiesExample(ByVal parent As IntPtr)#End If ' #If LEADTOOLS_V19_OR_LATER ThenIf (Not WiaSession.IsAvailable(WiaVersion.Version1)) ThenMessageBox.Show("WIA version 1.0 not installed.")ReturnEnd Ifsession = New WiaSession()session.Startup(WiaVersion.Version1)Dim res As DialogResult = session.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault)If res <> DialogResult.OK ThenMessageBox.Show("Error selecting WIA device.")session.Shutdown()ReturnEnd IfAddHandler session.EnumCapabilitiesEvent, AddressOf session_EnumCapabilitiesEventDim rootItem As Object = session.GetRootItem(Nothing)If Not rootItem Is Nothing Thensession.EnumCapabilities(rootItem, WiaEnumCapabilitiesFlags.None)End IfRemoveHandler session.EnumCapabilitiesEvent, AddressOf session_EnumCapabilitiesEventsession.Shutdown()End SubPrivate Sub session_EnumCapabilitiesEvent(ByVal sender As Object, ByVal e As WiaEnumCapabilitiesEventArgs)Dim strMsg As String = String.EmptyDim strPropAccess As String = String.EmptyDim strPropValue As String = String.EmptystrMsg = String.Format("WIA Capabilities count = {0}" & Constants.vbLf, e.CapabilitiesCount)Console.WriteLine(strMsg)' print out the received capability information into the console window.If e.CapabilitiesCount > 0 ThenConsole.WriteLine("Capability information:" & Constants.vbLf)' print out received capability property ID.strMsg = String.Format("Property ID:" & Constants.vbTab & "{0}" & Constants.vbLf, e.Capability.PropertyId.ToString())Console.WriteLine(strMsg)' print out received capability property Name.strMsg = String.Format("Property Name:" & Constants.vbTab & "{0}" & Constants.vbLf, e.Capability.PropertyName)Console.WriteLine(strMsg)' print out received capability property access.If (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.ReadWrite) = WiaPropertyAttributesFlags.ReadWrite ThenstrPropAccess &= "ReadWrite"ElseIf (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.Read) = WiaPropertyAttributesFlags.Read ThenstrPropAccess &= "Read"End IfIf (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.Write) = WiaPropertyAttributesFlags.Write ThenIf (Not String.IsNullOrEmpty(strPropAccess)) ThenstrPropAccess &= " | Write"ElsestrPropAccess &= "Write"End IfEnd IfEnd IfIf (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.Cashable) = WiaPropertyAttributesFlags.Cashable ThenIf (Not String.IsNullOrEmpty(strPropAccess)) ThenstrPropAccess &= " | Cashable"ElsestrPropAccess &= "Cashable"End IfEnd IfstrMsg = String.Format("Property Access:" & Constants.vbTab & "{0}" & Constants.vbLf, strPropAccess)Console.WriteLine(strMsg)' print out the capability property value(s) that were received.If (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.List) = WiaPropertyAttributesFlags.List ThenstrPropValue = "Property List Values:" & Constants.vbLfDim i As Integer = 0Do While i < e.Capability.Values.ListValues.ValuesCountIf (e.Capability.VariableType And WiaVariableTypes.Bstr) = WiaVariableTypes.Bstr ThenstrPropValue = strPropValue & Constants.vbTab + Convert.ToString(e.Capability.Values.ListValues.Values(i)) + Constants.vbLfElseIf (e.Capability.VariableType And WiaVariableTypes.Clsid) = WiaVariableTypes.Clsid ThenDim guidValue As System.Guid = CType(e.Capability.Values.ListValues.Values(i), System.Guid)strPropValue = strPropValue & Constants.vbTab + guidValue.ToString() + Constants.vbLfElsestrPropValue = strPropValue & Constants.vbTab + (Convert.ToInt32(e.Capability.Values.ListValues.Values(i))).ToString() & Constants.vbLfEnd Ifi += 1LoopElseIf (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.Range) = WiaPropertyAttributesFlags.Range ThenstrPropValue = String.Format("Property Range Values:" & Constants.vbLf + Constants.vbTab & "Minimum Value: {0}" & Constants.vbLf + Constants.vbTab & "Maximum Value: {1}" & Constants.vbLf, _e.Capability.Values.RangeValues.MinimumValue, e.Capability.Values.RangeValues.MaximumValue)ElseIf (e.Capability.PropertyAttributes And WiaPropertyAttributesFlags.Flag) = WiaPropertyAttributesFlags.Flag ThenstrPropValue = 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 appropriate GetPropertyXXX method according to the received variable type.strPropValue = "Property Value: "Dim rootItem As Object = session.GetRootItem(Nothing)If (e.Capability.VariableType And WiaVariableTypes.Bstr) = WiaVariableTypes.Bstr ThenDim stringValue As String = session.GetPropertyString(rootItem, Nothing, e.Capability.PropertyId)strPropValue &= stringValueElseIf (e.Capability.VariableType And WiaVariableTypes.Clsid) = WiaVariableTypes.Clsid ThenDim guidValue As Guid = session.GetPropertyGuid(rootItem, Nothing, e.Capability.PropertyId)strPropValue &= guidValue.ToString()ElseDim longValue As Integer = session.GetPropertyLong(rootItem, Nothing, e.Capability.PropertyId)strPropValue &= longValue.ToString()End IfEnd IfConsole.WriteLine(strPropValue)End IfEnd Sub
using Leadtools;using Leadtools.Codecs;using Leadtools.Wia;WiaSession session;[TestMethod]#if !LEADTOOLS_V19_OR_LATERpublic void EnumCapabilitiesExample(IWin32Window parent)#elsepublic void EnumCapabilitiesExample(IntPtr parent)#endif // #if !LEADTOOLS_V19_OR_LATER{if (!WiaSession.IsAvailable(WiaVersion.Version1)){MessageBox.Show("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){MessageBox.Show("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);}}
|
Products |
Support |
Feedback: EnumCapabilities Method - Leadtools.Wia |
Introduction |
Help Version 19.0.2017.3.21
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.