Classes that can be used for batch Scanning

Source: Internet
Author: User

In the past few days, I helped my colleagues solve the problem of connecting to the scanner. I checked WIA information and wrote a class, which is simple and shared to help you write scanning components.

This class requires the support of WIA components in windows. I put all the content in the additional code.

 

Using System;
Using System. Collections. Generic;
Using System. Text;
Using WIA;

Namespace Scaner
{
Public class Program
{
Public ImageFile Scan ()
{
DeviceManager manager = new DeviceManager ();
Device device = null;
Foreach (DeviceInfo info in manager. DeviceInfos)
{
If (info. Type! = WiaDeviceType. ScannerDeviceType) continue;
Device = info. Connect ();
Break;
}
Item item = device. Items [1];
CommonDialog cdc = new WIA. CommonDialog ();
ImageFile imageFile = cdc. ShowTransfer (item,
"{B96B3CAB-0728-11D3-9D7B-0000F81EF32E }",
True) as ImageFile;
Return imageFile;
}
}
}

Http://files.cnblogs.com/wengyuli/ScanApp.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.