public static string SelectDeviceUI() { Twain tw = new Twain(); if (!tw.Init(Application.OpenForms[0].Handle)) { throw new Exceptions.ENoScannerFound(); } tw.Select(); return tw.GetCurrentName(); }
public static string SelectDeviceUI() { Twain tw = new Twain(); if (!tw.Init(Application.OpenForms[0].Handle)) { throw new Exceptions.ENoScannerFound(); } tw.Select(); return(tw.GetCurrentName()); }
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); }
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(); } }
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(); }
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(); }