示例#1
0
 public static string SelectDeviceUI()
 {
     Twain tw = new Twain();
     if (!tw.Init(Application.OpenForms[0].Handle))
     {
         throw new Exceptions.ENoScannerFound();
     }
     tw.Select();
     return tw.GetCurrentName();
 }
示例#2
0
        public static string SelectDeviceUI()
        {
            Twain tw = new Twain();

            if (!tw.Init(Application.OpenForms[0].Handle))
            {
                throw new Exceptions.ENoScannerFound();
            }
            tw.Select();
            return(tw.GetCurrentName());
        }
示例#3
0
        public TwCapability(TwCap cap, short sval)
        {
            Cap     = (short)cap;
            ConType = (short)TwOn.One;
            Handle  = Twain.GlobalAlloc(0x42, 6);
            IntPtr pv = Twain.GlobalLock(Handle);

            Marshal.WriteInt16(pv, 0, (short)TwType.Int16);
            Marshal.WriteInt32(pv, 2, (int)sval);
            Twain.GlobalUnlock(Handle);
        }
示例#4
0
 public CTWAINAPI(string deviceName, Form pForm)
 {
     parent = pForm;
     tw = new Twain();
     if (!tw.Init(parent.Handle))
     {
         throw new Exceptions.EScannerNotFound();
     }
     if (!tw.SelectByName(deviceName))
     {
         throw new Exceptions.EScannerNotFound();
     }
 }
示例#5
0
 public CTWAINAPI(string deviceName, Form pForm)
 {
     parent = pForm;
     tw     = new Twain();
     if (!tw.Init(parent.Handle))
     {
         throw new Exceptions.EScannerNotFound();
     }
     if (!tw.SelectByName(deviceName))
     {
         throw new Exceptions.EScannerNotFound();
     }
 }
示例#6
0
 private void chooseTWAIN()
 {
     Twain tw = new Twain();
     if (!tw.Init(this.Handle))
     {
         MessageBox.Show("No device found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     tw.Select();
     txtDevice.Text = tw.GetCurrentName();
     currentDeviceID = tw.GetCurrentName();
 }
示例#7
0
 private void loadTWAIN()
 {
     Twain tw = new Twain();
     if (!tw.Init(this.Handle))
     {
         MessageBox.Show("No device found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         ScanSettings.DeviceID = "";
         currentDeviceID = "";
         txtDevice.Text = "";
         return;
     }
     if (!tw.SelectByName(ScanSettings.DeviceID))
     {
         MessageBox.Show("Device not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         ScanSettings.DeviceID = "";
         currentDeviceID = "";
         txtDevice.Text = "";
         return;
     }
     txtDevice.Text = tw.GetCurrentName();
     currentDeviceID = tw.GetCurrentName();
 }