Gets the equivalent string for the passed property ID.
public object GetRootItem(object item)
Public Function GetRootItem( _ByVal item As Object _) As Object
public:Object^ GetRootItem(Object^ item)
item
Handle to the item which represents the item for which you wish to retrieve its root item. You can 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.
The WIA root item handle.
Gets the root item for the item passed through the item*
Handle to the item which represents the item for which you wish to retrieve its root item. You can 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.
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.WiaDim wiaSession As WiaSession<TestMethod()> _#If Not LEADTOOLS_V19_OR_LATER ThenPublic Sub GetRootItemExample(ByVal parent As IWin32Window)#ElsePublic Sub GetRootItemExample(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 IfwiaSession = New WiaSession()wiaSession.Startup(WiaVersion.Version1)Dim res As DialogResult = wiaSession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault)If res <> DialogResult.OK ThenMessageBox.Show("Error selecting WIA device.")wiaSession.Shutdown()ReturnEnd IfDim rootItem As Object = wiaSession.GetRootItem(Nothing)If Not rootItem Is Nothing ThenAddHandler wiaSession.EnumItemsEvent, AddressOf session_EnumItemsEventwiaSession.EnumChildItems(rootItem)RemoveHandler wiaSession.EnumItemsEvent, AddressOf session_EnumItemsEventEnd IfwiaSession.Shutdown()End SubPrivate Sub session_EnumItemsEvent(ByVal sender As Object, ByVal e As WiaEnumItemsEventArgs)If Not e.Item Is Nothing ThenDim dataTransfer As WiaDataTransferProperties = WiaDataTransferProperties.EmptyDim imageEffects As WiaImageEffectsProperties = WiaImageEffectsProperties.EmptyDim properties As WiaProperties = wiaSession.GetProperties(e.Item)dataTransfer.ImageDataType = WiaImageDataType.GrayscaleimageEffects.Brightness = 250properties.DataTransfer = dataTransferproperties.ImageEffects = imageEffectsproperties.ScanningMode = WiaScanningModeFlags.Feeder ' set scanning source to Feederproperties.MaximumNumberOfPages = 0 ' scan all pages in feederproperties.ImageType = WiaImageType.Grayscaleproperties.Orientation = WiaOrientation.PortraitDim imageResolution As WiaImageResolutionProperties = properties.ImageResolutionimageResolution.BitsPerPixel = 8imageResolution.HorizontalResolution = 600imageResolution.VerticalResolution = 600properties.ImageResolution = imageResolutionAddHandler wiaSession.SetPropertiesEvent, AddressOf session_SetPropertiesEventwiaSession.SetProperties(e.Item, properties)RemoveHandler wiaSession.SetPropertiesEvent, AddressOf session_SetPropertiesEventwiaSession.FreeItem(e.Item)End IfEnd SubPrivate Sub session_SetPropertiesEvent(ByVal sender As Object, ByVal e As WiaSetPropertiesEventArgs)If e.Error <= 0 ThenConsole.WriteLine("Failed to set the below property:" & Constants.vbLf + Constants.vbTab & "Property Id: {0}" & Constants.vbLf + Constants.vbTab & "Property Value: {1}" & Constants.vbLf + Constants.vbTab & "Error: {2}" & _Constants.vbLf + Constants.vbLf, e.PropertyId.ToString(), Convert.ToInt32(e.Value).ToString(), e.Error.ToString())End IfEnd Sub
using Leadtools;using Leadtools.Codecs;using Leadtools.Wia;WiaSession wiaSession;[TestMethod]#if !LEADTOOLS_V19_OR_LATERpublic void GetRootItemExample(IWin32Window parent)#elsepublic void GetRootItemExample(IntPtr parent)#endif // #if !LEADTOOLS_V19_OR_LATER{if (!WiaSession.IsAvailable(WiaVersion.Version1)){MessageBox.Show("WIA version 1.0 not installed.");return;}wiaSession = new WiaSession();wiaSession.Startup(WiaVersion.Version1);DialogResult res = wiaSession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault);if (res != DialogResult.OK){MessageBox.Show("Error selecting WIA device.");wiaSession.Shutdown();return;}object rootItem = wiaSession.GetRootItem(null);if (rootItem != null){wiaSession.EnumItemsEvent += new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent);wiaSession.EnumChildItems(rootItem);wiaSession.EnumItemsEvent -= new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent);}wiaSession.Shutdown();}void wiaSession_EnumItemsEvent(object sender, WiaEnumItemsEventArgs e){if(e.Item != null){WiaDataTransferProperties dataTransfer = WiaDataTransferProperties.Empty;WiaImageEffectsProperties imageEffects = WiaImageEffectsProperties.Empty;WiaProperties properties = wiaSession.GetProperties(e.Item);dataTransfer.ImageDataType = WiaImageDataType.Grayscale;imageEffects.Brightness = 250;properties.DataTransfer = dataTransfer;properties.ImageEffects = imageEffects;properties.ScanningMode = WiaScanningModeFlags.Feeder; // set scanning source to Feederproperties.MaximumNumberOfPages = 0; // scan all pages in feederproperties.ImageType = WiaImageType.Grayscale;properties.Orientation = WiaOrientation.Portrait;WiaImageResolutionProperties imageResolution = properties.ImageResolution;imageResolution.BitsPerPixel = 8;imageResolution.HorizontalResolution = 600;imageResolution.VerticalResolution = 600;properties.ImageResolution = imageResolution;wiaSession.SetPropertiesEvent += new EventHandler<WiaSetPropertiesEventArgs>(wiaSession_SetPropertiesEvent);wiaSession.SetProperties(e.Item, properties);wiaSession.SetPropertiesEvent -= new EventHandler<WiaSetPropertiesEventArgs>(wiaSession_SetPropertiesEvent);wiaSession.FreeItem(e.Item);}}void wiaSession_SetPropertiesEvent(object sender, WiaSetPropertiesEventArgs e){if(e.Error <= 0){Console.WriteLine("Failed to set the below property:\n\tProperty Id: {0}\n\tProperty Value: {1}\n\tError: {2}\n\n", e.PropertyId.ToString(), Convert.ToInt32(e.Value).ToString(), e.Error.ToString());}}
|
Products |
Support |
Feedback: GetRootItem 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.