SetPropertyLong Method

Syntax
C#
C++/CLI
public void SetPropertyLong( 
   object item, 
   string propertyIdName, 
   WiaPropertyId propertyId, 
   int value 
) 
public: 
void SetPropertyLong(  
   Object^ item, 
   String^ propertyIdName, 
   WiaPropertyId propertyId, 
   int value 
)  

Parameters

item
Handle to the item which represents the item having the property. 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.

propertyIdName
This string should contain the equivalent property Id string for the WIA property ID. Use the GetPropertyIdString method to get this string for the property ID.

If you passed null for this parameter, then the WIA toolkit will use the property ID passed through the third parameter,

propertyId; otherwise, this parameter will be used whether or not you passed valid property ID through the propertyId parameter

propertyId
The property ID for the value being sought. For a list of available property IDs, see WiaPropertyId.

This parameter is required only if the second parameter, propertyIdName, is null; otherwise, you can pass 0 for this parameter.

value
The WIA long value to set.

Remarks

Call this function to set the Long value for any of the properties mentioned (for instance, WiaPropertyId.ScannerDeviceDocumentHandlingSelect, WiaPropertyId.DeviceInfoDevType, WiaPropertyId.ItemBufferSize, etc.)

Note:

Through our testing we have found that on some drivers while using WIA 2.0, if you want to change the Image Data Type property ( WiaPropertyId.ItemDatatype ) to your custom setting you have to set the WiaPropertyId.ScannerItemCurIntent property value to None.

For more information, refer to Managing WIA Sources.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Wia; 
 
 
WiaSession mySession; 
 
public void GetPropertyGuidExample(IntPtr parent) 
{ 
   if (!WiaSession.IsAvailable(WiaVersion.Version2)) 
   { 
      Console.WriteLine("WIA version 2.0 not installed."); 
      return; 
   } 
 
   mySession = new WiaSession(); 
   mySession.Startup(WiaVersion.Version2); 
 
   DialogResult res = mySession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault); 
   if (res != DialogResult.OK) 
   { 
      Console.WriteLine("Error selecting WIA device."); 
      mySession.Shutdown(); 
      return; 
   } 
 
   object rootItem = mySession.GetRootItem(null); 
   if (rootItem != null) 
   { 
      mySession.EnumItemsEvent += new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent3); 
 
      mySession.EnumChildItems(rootItem); 
 
      mySession.EnumItemsEvent -= new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent3); 
   } 
 
   mySession.Shutdown(); 
} 
 
void wiaSession_EnumItemsEvent3(object sender, WiaEnumItemsEventArgs e) 
{ 
   bool found = false; 
 
   if (e.Item != null) 
   { 
      // Read the item category property (this property is only available for WIA 2.0). 
      Guid sessionCategoryGuid = mySession.GetPropertyGuid(e.Item, null, WiaPropertyId.ItemCategory); 
 
      // Find the related item category for the received Guid. 
      Guid categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Feeder); 
      if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
      { 
         Console.WriteLine("Item category: Feeder"); 
         found = true; 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.FeederBack); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: FeederBack"); 
            found = true; 
         } 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.FeederFront); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: FeederFront"); 
            found = true; 
         } 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Film); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: Film"); 
            found = true; 
         } 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.FinishedFile); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: FinishedFile"); 
            found = true; 
         } 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Flatbed); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: Flatbed"); 
            found = true; 
         } 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Folder); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: Folder"); 
            found = true; 
         } 
      } 
 
      if (found == false) 
      { 
         categoryGuid = WiaSession.GetCategoryGuid(WiaCategories.Root); 
         if (categoryGuid == sessionCategoryGuid)   // the item is a Feeder. 
         { 
            Console.WriteLine("Item category: Root"); 
            found = true; 
         } 
      } 
 
      mySession.FreeItem(e.Item); 
   } 
} 
Requirements

Target Platforms

Help Version 22.0.2023.1.17
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.