←Select platform

AcquireSimple Method

Acquires one or more images from a WIA source.

public DialogResult AcquireSimple( 
   WiaVersion version, 
   IntPtr owner, 
   object item, 
   WiaDeviceType deviceType, 
   WiaAcquireFlags flags, 
   WiaProperties properties 
   DialogResult^ AcquireSimple( 
       WiaVersion^ version, 
      System::IntPtr owner, 
      Object^ item, 
      WiaDeviceType^ deviceType, 
      WiaAcquireFlags^ flags, 
      WiaProperties^ properties 
def AcquireSimple(self,version,owner,item,deviceType,flags,properties): 


The WIA version to be used. Possible values are:



WiaVersion.Version1 Use WIA version 1.0.
WiaVersion.Version2 Use WIA version 2.0.

Window handle of your application window.

This parameter is only used when acquiring from a scanner device while the ShowUserInterface flag is NOT set. Use this parameter to specify the scanner's paper source (Feeder or Flatbed).

This flag is optional. If you are using WIA 1.0, you can change the paper source by changing the WiaPropertyId.ScannerDeviceDocumentHandlingSelect property value for the root item, or by enumerating the available scanner items and passing the desired scanner item.

If you are using WIA 2.0, either enumerate the available scanner items and pass the desired scanner item; or pass null (Nothing in VB), in which case the enumeration will be performed internally and the first enumerated item will be used as the source item.

Specifies which type of WIA device to use. Possible values are:



WiaDeviceType.Default Generic WIA device. During device enumerations, this constant is used to enumerate all WIA devices. This is the default value.
WiaDeviceType.Scanner The device is a scanner.
WiaDeviceType.DigitalCamera The device is a camera. Note that this type of device is not supported by Windows Vista and later.
WiaDeviceType.StreamingVideo The device contains streaming video. Note that this type of device is not supported by Windows Server 2003, Windows Vista, or later.

Flag that determines certain actions of the WIA image acquisition selection dialog box. Possible values are:



WiaAcquireFlags.None Default behavior for the device image acquisition dialog box.
WiaAcquireFlags.NoDefault Force displaying the Select Device dialog box even if there is only one device available.
WiaAcquireFlags.SingleImage Restrict image selection to a single image in the device image acquisition dialog box. This flag is not available if you are using WIA version 2.0.
WiaAcquireFlags.ShowUserInterface Show the manufacturer's image acquisition dialog box.
WiaAcquireFlags.UseCommonUI Use the system user interface (UI), if available, rather than the vendor-supplied UI. If the system UI is not available, the vendor UI is used.


A WiaProperties structure containing the WIA properties for the currently selected data source.

Return Value

One of the DialogResult values. If an error occurs, an exception is thrown.


This is a high level acquire function that can be called directly. When using this function, the following functions are called internally:

You can change the AcquireOptions property members before calling this method to control some options while acquiring from the WIA source.

Set this method to perform memory transfer or file transfer by performing one of the following actions:

To perform memory transfer, add the AcquireEvent event to receive the acquired page(s). The event will also provide you with the percent completion of the page transfer progress.

When performing file transfer it is optional to add the AcquireEvent event since the event will only provide you with the saved file path and the percent completion of the file saving process.

When performing file transfer two properties within the WiaSession class become available:

  • FilesCount - contains the number of files being saved.
  • FilesPaths - a collection that contains the saved file paths and filenames.

To cancel the acquire operation, add the AcquireEvent event and set the Cancel member of the WiaAcquireEventArgs to true.

For more information, refer to How to Acquire from the WIA Source.

using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Wia; 
public void AcquireSimpleExample(IntPtr parent) 
   WiaSession wiaSession = new WiaSession(); 
   // Initialize and fill the required fields from the WiaDataTransferProperties structure  
   WiaDataTransferProperties wiaDataTransferProperties = WiaDataTransferProperties.Empty; 
   wiaDataTransferProperties.TransferMode = WiaTransferMode.Memory; 
   wiaDataTransferProperties.Compression = WiaCompressionMode.None; 
   // Initialize and fill the required fields from the WiaProperties structure  
   WiaProperties wiaProperties = WiaProperties.Empty; 
   wiaProperties.DataTransfer = wiaDataTransferProperties; 
   wiaSession.AcquireEvent += new EventHandler<WiaAcquireEventArgs>(wiaSession_AcquireSimpleEvent); 
   wiaSession.AcquireSimple(WiaVersion.Version1, parent, null, WiaDeviceType.Default, WiaAcquireFlags.ShowUserInterface | WiaAcquireFlags.UseCommonUI, wiaProperties); 
   wiaSession.AcquireEvent -= new EventHandler<WiaAcquireEventArgs>(wiaSession_AcquireSimpleEvent); 
public void wiaSession_AcquireSimpleEvent(object sender, WiaAcquireEventArgs e) 
   if ((e.Flags & WiaAcquiredPageFlags.StartOfPage) == WiaAcquiredPageFlags.StartOfPage) 
      Console.WriteLine("Beginning of data transfer."); 
   else if ((e.Flags & WiaAcquiredPageFlags.EndOfPage) == WiaAcquiredPageFlags.EndOfPage) 
      Console.WriteLine("End of data transfer."); 
   if (e.Image != null) 
      // You can load the image here.  

Target Platforms

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.